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
HazelcastClusterManager#getAsyncMultiMap memory leak #316
Comments
can you investigate @tsegismont ? |
@michalsida nice catch! This is an area where we would like to improve the ClusterManager SPI. The SPI grew out of the initial Hazelcast implementation, and the The good news is that Hazelcast (and Infinispan) cluster manager would use that method to remove the listener. |
I needed this method for some (a little dirty) hack of other project and I started to use it the same way (= call it only once). |
This allows cluster managers to free resources they use to maintain the state. Needed for vert-x3/issues#316 Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Calling ClusterManager.getAsyncMultiMap multiple times can leak memory has the map listener is still registered. See vert-x3/issues#316
Calling ClusterManager.getAsyncMultiMap multiple times can leak memory as the cache listener is still registered. See vert-x3/issues#316
@vietj I sent a PR to core as well as HZ and ISPN cluster managers. |
@michalsida is this workaround still needed after the fix for vert-x3/vertx-hazelcast#90 is merged in master? |
Closing as vert-x3/vertx-hazelcast#90 should remove the need for creating many multimaps. |
Repeating call cause probably a memory leak. In this call is created a new one
HazelcastAsyncMultiMap
- a wrapper for Hazelcast MultiMap, it is stored into weak set and send it to the result handler. So if the result handler throw the reference away, it should be removed from weak set too.But.
There is a call of
com.hazelcast.core.MultiMap#addEntryListener(this, true)
in theHazelcastAsyncMultiMap
constructor, which will store a strong reference to the object to some Hazelcast'sConcurrentHashMap
of registered listeners. And it will prevent a garbage collecting ofHazelcastAsyncMultiMap
instance (and referenced data/objects), which is unused by result handler already.Detected in version: 3.5.0
The text was updated successfully, but these errors were encountered: