-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
RecyclerPool Memory leak in 2.17.0 #4500
Comments
This is a known issue. I only have my phone at the moment but if you search around, you'll see that this pool is not working well. Stick with Jackson 2.16 or override the recycler pool to use the thread local one. 2.17.1 goes back to that pool as the default. |
Thanks! |
Sort of dup of FasterXML/jackson-core#1260 as well -- by now issue that we are fully aware of, and 2.17.1 having patch (to revert situation to 2.16.x) stage. But still trying to figure out some of details to know path for 2.18+ and 3.0. |
@jkuhn1 One interesting note: this is specifically about serialization -- I wrote a similar tool to reproduce, but combined reads and writes. But I am beginning to feel that this might be more about just serialization (writer) side. Would it be easy enough for you to see if fast (small) reads only would trigger this issue? (I'll modify my own test once I return home, travelling now). The current hypothesis wrt LockFreePool is that due to unreliable method of acquire AND release operations there can be pretty unexpected imbalance so that instead of the usual cycle of:
looks like under some conditions One thing, tho, that in my reproduction imbalance only occurred during initial stages and always rebalanced after a while. This may not be enough to be acceptable (since the initial peak can be rather severe...), but is something that other reproductions might not see. |
Ok, I was specifically curious on whether "extreme memory retention" would occur for both -- vs. in general more overhead. It would make most sense for both to be heavily affected, and possibly trigger the same imbalancing problem. EDIT: Quick update: modifying |
Default |
Search before asking
Describe the bug
I discovered a memory leak while performing performance test in a multi threaded environment. This seems to be due to the switch to the
LockFreePool
introduced in 2.17.0.I'm not sure whether this is a bug or misusage also it clearly looks like a bug considering that the behaviour is degraded compared to 2.16.2 but please advice what would be a proper usage.
Version Information
2.17.0
Reproduction
In order to reproduce the leak, I created a simple program that starts 16 threads that all serialize a simple object multiple times using a common ObjectMapper instance which is thread safe as per documentation.
Using JConsole to monitor the heap I could see that the memory is stuck around 800MB (after GC):
The heap dump speaks for itself:
Expected behavior
I expect the tasks to complete and the heap consumption to get back to normal. The same application run with 2.16.2 terminates with a heap around 9MB after GC.
Additional context
I run the app with OpenJDK 21.0.2
The text was updated successfully, but these errors were encountered: