-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffering needs to be configurable #3704
Comments
Yes this needs to be better integrated with the config system. I do have to ask why you're trying to buffer a 300MB upload? At a certain point buffering becomes impractical and you need to find an alternative algorithm for processing your data. |
We need this to be able to upload machine learning models that are a big binary blob. This is not a frequent call. Only done by admins of the API. We are not worried about scalability of this call. |
What happens to it once it's buffered? In memory processing, or copied to permanent storage? Any reason those operations can't be streamed? |
In memory processing, we need to do a few lightweight checks in the API before we save it. |
|
Buffering is off by default. How are you reading the request body? Some of the MVC components may opt to buffer. Yes, there's a RequestSizeLimitAttribute. But watch out for IIS's conflicting limit. |
If you check in the stack trace JsonInputFormatter is in the stack. We are using the usual model binding. |
Yes we are using NSwag to autogenerate the client. It would be awesome if we could auto-generate the same client but with protobuf instead of json. 300MB and it is compressed. |
I'm trying to enable a read-only file system in Docker (See https://github.com/RehanSaeed/ReadOnlyDockerTest). Buffering to a temp file system is not going to work in that scenario.
Which ones exactly? Is Buffering only turned on when |
The JSON and XML model binders buffer the request body before reading it as they don't have async parsing APIs. |
Will this be the case with the new JSON API's in .NET Core 3? |
No, that's one of the main things we're planning to fix. |
Microsoft happened to have blogged about this today: |
@Tratcher what's the work here? |
These APIs need to be updated to resolve the temp directory from DI -> Options -> Config -> Environment. |
I remember this discussion on how we do this. I'm not sure it's worth the trouble flowing that to these APIs. Do we need better docs about |
It's mentioned in the linked doc. It stands out because it's the only thing in the framework that's configured this way. |
I think that's fine, the effort to flow configuration to this part of the stack isn't worth it. |
Duplicate of #9466 |
@Tratcher Since we have async API's for JSON now, Is your earlier statement no longer true and can we now safely enable readonly Docker file systems?
|
For JSON, yes the async model binding parser is now the default. For XML you still need to buffer. |
I got this exception because my request was 300MB and I was running in an Azure Cloud Service. Azure Cloud services cannot write to temp storage they need to configure a disk space and write to a specific directory. It was very difficult to find that I had to set a environment variable (ASPNETCORE_TEMP) to configure this. https://github.com/aspnet/HttpAbstractions/blob/07d115400e4f8c7a66ba239f230805f03a14ee3d/src/Microsoft.AspNetCore.Http/Internal/BufferingHelper.cs#L25-L26
Expected: This should be a first class config and documented.
The text was updated successfully, but these errors were encountered: