-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
OutOfDirectMemoryError for large uploads using HttpPostMultipartRequestDecoder #10973
Comments
@fredericBregier It could be related to #10623 given that right now file isn't written until a delimiter is found? |
I think so too... I think we should never the commit in question for now as while it fixes some "perf issues" when running in with paranoid leak detection I don't think it has any other benefits in real world use-cases. @fredericBregier WDYT ? |
Hi, the issue is partially related but yet an issue.
I agree that this should be changed to adapt the solution with the new way to find the delimiter. Perhaps this?
If it is written (in Disk mode or Mixed mode and if size is greater than limit), the buffer might be cleared (free), so one could try to change this such as:
Not sure it will work or easy to implement, but I think the idea is there... |
Hi all, I propose a fix for this (adding a test inspired from the one given, testing both in Memory and on Disk behaviors) |
…oder to e5951d4 Motivation: The changes introduced in 1c23040 did cause various issues while the fix itself is not considered critical. For now it is considered the best to just rollback and investigate more. Modifications: Revert changes done in 1c23040 (and later) for the post decoders. Result: Fixes #10973
Motivation: While improvements were made on finding delimiters, when HttpDatas do not fit in memory while using Mixed or Disk mode in HttpDataFactory, the memory was exhausted. Modifications: Change the way `loadDataMultipart` tries to add contents. Instead of waiting to found the delimiter, it will add the current buffer and, if possible, will try to reuse the current allocated buffer. As the chunk is a retained buffer from the original one, if the `refCnt()` is 1 after the `addContent`, then it can be "virtually" released (changing reader and writer indexes). Note: if the HttpDataFactory is in Memory only, this will not prevent OOME since the full data will be kept in memory. Result: Now the memory cunsumption in Mixed mode or Disk mode is restricted to the minimum. A test is added to check both in Memory and on Disk behaviors.
…oder to e5951d4 (#10989) Motivation: The changes introduced in 1c23040 did cause various issues while the fix itself is not considered critical. For now it is considered the best to just rollback and investigate more. Modifications: - Revert changes done in 1c23040 (and later) for the post decoders. - Ensure we give memory back to the system as soon as possible in a safe manner Result: Fixes #10973
…oder to e5951d4 (#10989) Motivation: The changes introduced in 1c23040 did cause various issues while the fix itself is not considered critical. For now it is considered the best to just rollback and investigate more. Modifications: - Revert changes done in 1c23040 (and later) for the post decoders. - Ensure we give memory back to the system as soon as possible in a safe manner Result: Fixes #10973
Thanks to both of you. The new version is working well now. The performance degradation with paranoid detection is very noticeable (e.g. a test with a lot of data moving was taking 1 second in So if anyone else is experiencing this and wondering what is going on, try disabling PARANOID for the slow tests. |
@danielflower or maybe wait for #11001 which fixes also this PARANOID issue, and improves without this level also performances (about 4 times)... ;-) |
The #11001 PR is merged now. |
…oder to e5951d4 (netty#10989) Motivation: The changes introduced in 1c23040 did cause various issues while the fix itself is not considered critical. For now it is considered the best to just rollback and investigate more. Modifications: - Revert changes done in 1c23040 (and later) for the post decoders. - Ensure we give memory back to the system as soon as possible in a safe manner Result: Fixes netty#10973
Expected behavior
With a
HttpDataFactory
that hasuseDisk=true
, I thought files of any size could potentially be uploaded.Actual behavior
Example error from below unit test:
Steps to reproduce
Set
-Xmx64m
and run below unit test.Minimal yet complete reproducer code (or URL to code)
Netty version
Tested on
4.1.56
and4.1.58
.JVM version (e.g.
java -version
)jdk1.8.0_162 and 12
OS version (e.g.
uname -a
)Windows 10
The text was updated successfully, but these errors were encountered: