Keep instantiated OffsetMapCodecManager so that metrics will not be recreated every commit #859#892
Conversation
…ecreated every commit confluentinc#859 We can see the OffsetMapCodecManager being instantiated every second or so, which creates 3 new Meters (Timer, Gauge, Counter) every time. Because they are references from the registeredMeters array in PCMetrics, this creates a significant memory leak over time.
|
Nacho Muñoz Gómez (@nachomdo) or Roman Kolesnev (@rkolesnev) Are you maybe part of the reviewer group and can have a look at this PR? |
|
Stephen Hegarty (@stephenheg) John Byrne (@johnbyrnejb) Would any of you be available to review this fix? I was hoping to get the memory leak fixed before black friday :-) |
|
Martyn Ye (@sangreal) Are you part of the reviewer group and can help out here with a review? |
|
sorry, I am not a official Confluent reviewer |
Roman Kolesnev (rkolesnev)
left a comment
There was a problem hiding this comment.
LGMT.
Stefan Pries (@priesus) - Changelog / readme needs to be updated please as well - you can see how its updated in other PRs - its the CHANGELOG.adoc file and then once its updated - regenerate readme to take in the changes - mvn asciidoc-template:build .
John Byrne (@johnbyrnejb) - could you please do formal approval / merge to master once docs are updated?
Hey Stefan Pries (@priesus) - i dont work for Confluent anymore and dont use Parallel Consumer in my current day to day - but i try to keep an eye on it when i have a bit of time... |
|
Roman Kolesnev (@rkolesnev) Thanks so much for the feedback! I've updated the changelog & readme. |
|
John Byrne (@johnbyrnejb) I believe my changes broke the master branch build. I'm unable to see the build logs and I'm also unable to run the tests myself because our company policy doesn't let us use the maven repositories required by this project. |
|
Just to clarify: To verify my changes I had to copy the /src/main/java into one of our projects and I was able to fix the memory leak with the changes from this PR. So I assume the build issue is related to a test. Let me see if I can troubleshoot this somehow. |
|
John Byrne (@johnbyrnejb) So far I am still unable to get the tests to run locally, because I am unable to fetch the |
it wouldn't have bene broken, but the truth def is on githubs maven distribution system. I'm going to publish it to maven central soon to avoid this problem. |

We can see the OffsetMapCodecManager being instantiated every second or so, which creates 3 new Meters (Timer, Gauge, Counter) every time.
Because they are referenced from the registeredMeters list in PCMetrics, the duplicate Meters and Tags won't be cleaned up by garbage collection. This creates a significant memory leak over time (issue #859).
This is my first open source contribution, please let me know if this change doesn't make sense or what contribution guidelines I have missed!
Checklist