Skip to content
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

Merged

Conversation

ihsandemir
Copy link
Contributor

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.

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.
@ihsandemir ihsandemir added this to the 3.7.3 milestone Oct 26, 2016
@ihsandemir ihsandemir self-assigned this Oct 26, 2016
…thBinaryInMemoryFormat and putToCacheAndGetInvalidationEventWhenNodeShutdownWithObjectInMemoryFormat as indicated at hazelcast#9172 (comment)
@ihsandemir ihsandemir force-pushed the maint/backports/PR8848 branch 2 times, most recently from 92960a5 to 4102c25 Compare October 30, 2016 11:08
@devOpsHazelcast
Copy link
Collaborator

Test PASSed.

@devOpsHazelcast
Copy link
Collaborator

Test PASSed.

… before instead of creating a new one. This eliminates a lot of endpoint to getEndpoint() changes.
@devOpsHazelcast
Copy link
Collaborator

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.
@devOpsHazelcast
Copy link
Collaborator

Test PASSed.

@devOpsHazelcast
Copy link
Collaborator

Test PASSed.

@alparslanavci
Copy link
Contributor

Backport of #8848. Just mentioning here to connect the PRs.

@devOpsHazelcast
Copy link
Collaborator

Test PASSed.

@devOpsHazelcast
Copy link
Collaborator

@@ -55,7 +55,7 @@ public void run() throws Exception {

@Override
public boolean returnsResponse() {
return Boolean.TRUE;
return Boolean.FALSE;
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, corrected.

@devOpsHazelcast
Copy link
Collaborator

…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.
Copy link
Contributor

@vbekiaris vbekiaris left a 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() {
Copy link
Contributor

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.
}
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newlines leftover

Copy link
Contributor Author

@ihsandemir ihsandemir Nov 4, 2016

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

@ihsandemir
Copy link
Contributor Author

run-lab-run

@devOpsHazelcast
Copy link
Collaborator

Test PASSed.

1 similar comment
@devOpsHazelcast
Copy link
Collaborator

Test PASSed.

@ihsandemir ihsandemir merged commit f27eda4 into hazelcast:maintenance-3.x Nov 5, 2016
@ihsandemir ihsandemir deleted the maint/backports/PR8848 branch November 5, 2016 08:20
@ihsandemir
Copy link
Contributor Author

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.

ihsandemir added a commit to ihsandemir/hazelcast that referenced this pull request Nov 14, 2016
ihsandemir added a commit that referenced this pull request Nov 15, 2016
* 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
emrahkocaman pushed a commit to emrahkocaman/hazelcast that referenced this pull request Nov 25, 2016
* 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
@mmedenjak mmedenjak added the Source: Internal PR or issue was opened by an employee label Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Source: Internal PR or issue was opened by an employee Team: Client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants