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
Fix(Memory Leak): Remove FencedLockProxy upon FencedLock#destroy [HZ-3039] #25353
Fix(Memory Leak): Remove FencedLockProxy upon FencedLock#destroy [HZ-3039] #25353
Conversation
@arodionov if you can take a look -- if it seems reasonable I will add some testing post-comments. |
Thanks for the PR, Granville. Map with lock proxies created on the server side (if using Hazecast in an embedded mode) or on the client side. When the same lock is used from several Hazelcast clients or embedded instances, it means that every client/instance will have a such proxy and this proxy will be added to the maps on each instance:
Therefore, if we decide to remove the destroyed lock from the proxy's map, it means that it can be removed only from the instance from which the "destroy" method was called.
Other clients/instances will be unaware that the lock has been destroyed. So, I am wondering, does it make sense to provide a "partial" cleaning at all? |
@arodionov I agree -- even with client changes you only ever cleanup the client that called the I had a look at removing the lock proxy in the Python client -- it looks simple but I also had same thought w.r.t. only fixing the client that actually called the |
Yes, for the embedded mode (server-side) proxies, I think we can proceed with removing the proxy from the Please try to add some tests for the current PR. |
@gbarnett-hz The |
Cheers @arodionov -- will take a look |
hazelcast/src/test/java/com/hazelcast/cp/internal/datastructures/lock/FencedLockBasicTest.java
Outdated
Show resolved
Hide resolved
hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/LockService.java
Outdated
Show resolved
Hide resolved
hazelcast/src/test/java/com/hazelcast/cp/internal/datastructures/lock/FencedLockBasicTest.java
Outdated
Show resolved
Hide resolved
hazelcast/src/test/java/com/hazelcast/cp/internal/datastructures/lock/FencedLockBasicTest.java
Outdated
Show resolved
Hide resolved
hazelcast/src/test/java/com/hazelcast/cp/internal/datastructures/lock/FencedLockBasicTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Thanks, Granville!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the fix @gbarnett-hz
FencedLock myLockMember2 = instances[2].getCPSubsystem().getLock(lockName); | ||
|
||
myLockMember0.lock(); | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I appreciate the try-finally style, but what is the point when there is no statement in the try block?
…3039] (hazelcast#25353) Removes the `FencedLockProxy` from `LockService.proxies` _after_ calling legacy semantics of `AbstractBlockingService#destroyRaftObject`. Previously the `FencedLockProxy` would be resident in `LockService.proxies` until the CP system was reset. Fixes hazelcast#25344 (cherry picked from commit e301940)
…3039] [5.3.z] (#25421) Removes the `FencedLockProxy` from `LockService.proxies` _after_ calling legacy semantics of `AbstractBlockingService#destroyRaftObject`. Previously the `FencedLockProxy` would be resident in `LockService.proxies` until the CP system was reset. Fixes #25344 Backport of: #25353
Removes the
FencedLockProxy
fromLockService.proxies
after calling legacy semantics ofAbstractBlockingService#destroyRaftObject
. Previously theFencedLockProxy
would be resident inLockService.proxies
until the CP system was reset.Fixes #25344
Backport of: INSERT_LINK_TO_THE_ORIGINAL_PR_HERE
EE PR: INSERT_LINK_TO_THE_EE_PR_HERE
Breaking changes (list specific methods/types/messages):
Checklist:
Team:
,Type:
,Source:
,Module:
) and Milestone setAdd to Release Notes
orNot Release Notes content
set@Nonnull/@Nullable
annotations@since
tags in Javadoc