-
Notifications
You must be signed in to change notification settings - Fork 155
fix memory leak with logger #360
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
Conversation
Found another instance of this error in the code in SocketConnection. Should be orders of magnitude harder to get this to levels that would cause stability issues in application code, but it is still not right. |
Hello @if6was9, Do you by any chance have a heap dump to share? What objects are leaking? I guess you have a problem with amount of logger instances and not string concatenation. Thanks for raising this issue. |
Yes. The number of logger instances is effectively unbounded. I can't share the heap dump itself, but here is the histogram output that lead to the issue: Having 25M LogNode instances caught my eye.
|
BTW, the JDK does implement its cache of Loggers with weak references. So the weak references should be eligible for GC. But for reasons unknown the GC is unable to reclaim them. It think this falls into the "don't do that" category and all problems just go away. |
Thanks for the info. We could save session and connection IDs by putting them in messages instead of logger names. What do you think about this? I'm happy to merge this change. Could you please sign the code-contribution CLA? (build will go green when CLA is signed) |
I am closing this one as #362 is already merged. Thank again for raising this PR |
Someone at neo4j may have a better fix for this.
The logger was clearly constructed in this way with the intention of aiding diagnostics. But looking through the usage of this logger, the instance id provided by the Session.hashCode() doesn't appear to be all that useful, so I just took it out. But maybe someone at neo4j has a preferred method of fixing.
That said, it leaks memory, so it just needs to be fixed.
Just to give some context, rough estimates are that we are doing ~100 transactions/second. This burned through a 6GB heap in a few days.