-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Support for limits on input stream processing in WebFlux codecs #23884
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
Comments
- Add maxInMemorySize property to Decoder and HttpMessageReader implementations that aggregate input to trigger DataBufferLimitException when reached. - For codecs that call DataBufferUtils#join, there is now an overloaded variant with a maxInMemorySize extra argument. Internally, a custom LimitedDataBufferList is used to count and enforce the limit. - Jackson2Tokenizer and XmlEventDecoder support those limits per streamed JSON object. See gh-23884
- Add maxInMemorySize property to Decoder and HttpMessageReader implementations that aggregate input to trigger DataBufferLimitException when reached. - For codecs that call DataBufferUtils#join, there is now an overloaded variant with a maxInMemorySize extra argument. Internally, a custom LimitedDataBufferList is used to count and enforce the limit. - Jackson2Tokenizer and XmlEventDecoder support those limits per streamed JSON object. - Configurable limits for multipart requests with Synchronoss NIO. - Centralized maxInMemorySize exposed via CodecConfigurer along with ability to plug in an instance of MultipartHttpMessageWrite. Closes gh-23884
For an overview see "Limits" section in the reference documentation. |
I know this issue was closed in October, but I'm curious @rstoyanchev if you could explain what the downside of not having a limit is? In other words prior to implementing the limit, what could go wrong if the size was very large and how would that manifest; such that adding a limit by default is an effective protection? |
@scottjohnson there is some explanation in the docs. It's about making it easy for applications to declare limits on input buffering. In the absence of such limits the application can run out of memory. |
While a proxy, or the underlying server, or a
WebFilter
can be used to enforce general limits on the size of server request input, it would be helpful forDecoder
andHttpMessageReader
implementations to expose configurable limits too, because codecs in WebFlux can parse asynchronously and pass one object one at a time to the application, as a stream. That means the overall request input stream may be infinite, and it's the input per streamed object that should be limited.The text was updated successfully, but these errors were encountered: