Skip to content

put_async resulting in OOM #540

@aabed-aa

Description

@aabed-aa

I am working on a project which is using Obstore in combination with FastAPI. I have implemented an endpoint to perform file uploads, what I noticed is that bigger files cause OOM errors due to put_async. Here are some details:

I have an endpoint (redacted for brevity) that looks like this:

@router.post(
    "/upload",
)
async def upload(
    request: Request,
):
     # Stream the file to S3
     store = S3Store(...)
     await obstore.put_async(store, some_path, request.stream())

Since I am using request.stream() as the file I am expecting the put operation to directly stream the data to the S3 bucket. What is actually happening is that my application is crashing with an OOM error. The application is running in a pod with a limit of 2gb memory., the file I am uploading is 3.5gb. Increasing the limit solves the issue but this means multiple uploads to this service will still cause an OOM. For sanity I iterated over the request.stream() without put_async and this did not affect memory usage.

Any advice how to perform a streaming upload using Obstore?

Obstore version: 0.8.0
Python version: 3.13.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions