-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Hazelcast listeners are lost during cluster disconnects - Backport PR #8848 #9183
Hazelcast listeners are lost during cluster disconnects - Backport PR #8848 #9183
Conversation
Fixes the client listener registration if the client owner connection is lost and reconnected (e.g. due to heartbeat or network problems). Authentication response returns a list of members at which the client is unregistered so that the listener service acts upon this list. The smart listener service re-registers the listeners to these unregistered members. The non-smart listener service re-registers the listeners only if the reconnected member is not the same as the previous member or the previous member client resources were cleaned up. The ClientDisconnectionOperation also acts smart so that it only cleans client resources if the dead member uuid is the current owner member uuid of the client and there is no alive connection endpoint to the client. For compatibility, when client is connected to earlier versions the smart listener service re-registers all existing listeners.
…thBinaryInMemoryFormat and putToCacheAndGetInvalidationEventWhenNodeShutdownWithObjectInMemoryFormat as indicated at hazelcast#9172 (comment)
92960a5
to
4102c25
Compare
Test PASSed. |
3762539
to
060d8ff
Compare
Test PASSed. |
… before instead of creating a new one. This eliminates a lot of endpoint to getEndpoint() changes.
Test PASSed. |
…on for 3.7.x minor version compatibility of the operation. Instead of this field just uses any existing alive connection to the client to decide if ClientDisconnectionOperation shoud run or not.
Test PASSed. |
Test PASSed. |
Backport of #8848. Just mentioning here to connect the PRs. |
Test PASSed. |
@@ -55,7 +55,7 @@ public void run() throws Exception { | |||
|
|||
@Override | |||
public boolean returnsResponse() { | |||
return Boolean.TRUE; | |||
return Boolean.FALSE; |
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.
just nitpicking here, this is unnecessary unboxing, we could just return the primitive false
directly.
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.
OK, corrected.
9c844df
to
b7e82b0
Compare
…n any response and changed the smart listener to reregister all the listeners on cluster reconnect. The Smart listener is not using the cleanedup member list and this list is not beign populated for backward compatibility.
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.
👍 with minor comments
* This ExceptionHandler rethrows {@link java.util.concurrent.ExecutionException}s and logs | ||
* {@link com.hazelcast.core.MemberLeftException}s to the log. | ||
*/ | ||
public static final ExceptionHandler RETHROW_ALL_EXCEPT_MEMBER_LEFT = new ExceptionHandler() { |
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.
This exception handler doesn't seem to have any usages, maybe remove it from the final PR?
@@ -5751,3 +5705,6 @@ public void handle(java.util.Collection<com.hazelcast.map.impl.querycache.event. | |||
} | |||
} | |||
|
|||
|
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.
newlines leftover
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.
This is a generated test, i need to remove them in its ftl file in client-protocol. It does not look urgent, hence i will just open an issue for this and correct ftl later.
Issue: hazelcast/hazelcast-client-protocol#33
run-lab-run |
Test PASSed. |
1 similar comment
Test PASSed. |
Some more details: When the client for some reason loses the connection the member which is the owner for the client, it becomes CLIENT_DISCONNECTED and client reconnects to another member and then its lifecycle state becomes CLIENT_CONNECTED again. When this reconnection happen, it does re-register all the listeners to the members. It is different when losing connection to non-owner member. If non owner connection is lost, no action needs to be taken in terms of listeners. The listeners are registered to any new members which join the cluster. Hence, you do not need to reregister any existing listeners since we are taking care of it at the background. |
* Fixes the client listener registration if the client owner connection is lost and reconnected (e.g. due to heartbeat or network problems). Authentication response returns a list of members at which the client is unregistered so that the listener service acts upon this list. The smart listener service re-registers the listeners to these unregistered members. The non-smart listener service re-registers the listeners only if the reconnected member is not the same as the previous member or the previous member client resources were cleaned up. The ClientDisconnectionOperation also acts smart so that it only cleans client resources if the dead member uuid is the current owner member uuid of the client and there is no alive connection endpoint to the client. * Forward port of fixes at #9183
* Fixes the client listener registration if the client owner connection is lost and reconnected (e.g. due to heartbeat or network problems). Authentication response returns a list of members at which the client is unregistered so that the listener service acts upon this list. The smart listener service re-registers the listeners to these unregistered members. The non-smart listener service re-registers the listeners only if the reconnected member is not the same as the previous member or the previous member client resources were cleaned up. The ClientDisconnectionOperation also acts smart so that it only cleans client resources if the dead member uuid is the current owner member uuid of the client and there is no alive connection endpoint to the client. * Forward port of fixes at hazelcast#9183
Fixes the client listener registration if the client owner connection is lost and reconnected (e.g. due to heartbeat or network problems).
Authentication response returns a list of members at which the client is unregistered so that the listener service acts upon this list. The smart listener service re-registers the listeners to these unregistered members. The non-smart listener service re-registers the listeners only if the reconnected member is not the same as the previous member or the previous member client resources were cleaned up.
The ClientDisconnectionOperation also acts smart so that it only cleans client resources if the dead member uuid is the current owner member uuid of the client and there is no alive connection endpoint to the client.
For compatibility, when client is connected to earlier versions the smart listener service re-registers all existing listeners.