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

Refactoring client deregister listener behaviour #17646

Merged
merged 2 commits into from
Oct 5, 2020

Conversation

sancar
Copy link
Contributor

@sancar sancar commented Sep 30, 2020

We were returning false as the return value if we were not
successuflly deregister from any member and events was able to
continue to delivered for non deregistered members.

We have changed the behaviour so that we return true if a
registration is found always. And after this point, user will not
get any event. We will cleanup all the local handlers right away
to make sure of that.

Secondly we have set invocation timeout as infinite so that the
deregistartion from a connection is retried as long as the
connection is there until it is succesful.

I have left logging the exception when there is an unexpected
failure. We do not expect any but this is to be able to diagnose
if the unexpected happens.

@sancar sancar added this to the 4.1 milestone Sep 30, 2020
@sancar sancar requested a review from a team as a code owner September 30, 2020 11:17
@sancar sancar self-assigned this Sep 30, 2020
We were returning `false` as the return value if we were not
successuflly deregister from any member and events was able to
continue to delivered for non deregistered members.

We have changed the behaviour so that we return `true` if a
registration is found always. And after this point, user will not
get any event. We will cleanup all the local handlers right away
to make sure of that.

Secondly we have set invocation timeout as infinite so that the
deregistartion from a connection is retried as long as the
connection is there until it is succesful.

I have left logging the exception when there is an unexpected
failure. We do not expect any but this is to be able to diagnose
if the unexpected happens.
@sancar sancar force-pushed the fix/deregisterListener/master branch from 54da2f0 to b7169be Compare September 30, 2020 14:34
Copy link
Contributor

@puzpuzpuz puzpuzpuz left a comment

Choose a reason for hiding this comment

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

LGTM. Left some nits.

Copy link
Contributor

@ihsandemir ihsandemir left a comment

Choose a reason for hiding this comment

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

is it possible to write a test for the unhappy path?

@sancar
Copy link
Contributor Author

sancar commented Oct 5, 2020

@ihsandemir We have tests for failure scenarios like terminate , heartbeat timeout etc in AbstractListenersOnReconnectTest.

@sancar sancar merged commit 2cc3038 into hazelcast:master Oct 5, 2020
@sancar sancar deleted the fix/deregisterListener/master branch October 5, 2020 08:30
@mmedenjak mmedenjak added the Source: Internal PR or issue was opened by an employee label Oct 5, 2020
@hazelcast hazelcast deleted a comment Oct 5, 2020
mdumandag added a commit to mdumandag/hazelcast-python-client that referenced this pull request Nov 20, 2020
Listener service was waiting for the result of the future
in a blocking way and, returning the registration id string.

This is not in line with our other APIs in which we provide
non-blocking API.

Also, the slight behaviour change applied to Java client is
ported to Python client. hazelcast/hazelcast#17646
mdumandag added a commit to mdumandag/hazelcast-python-client that referenced this pull request Nov 20, 2020
Listener service was waiting for the result of the future
in a blocking way and, returning the registration id string.

This is not in line with our other APIs in which we provide
non-blocking API.

Also, the slight behaviour change applied to Java client is
ported to Python client. hazelcast/hazelcast#17646
mdumandag added a commit to hazelcast/hazelcast-python-client that referenced this pull request Nov 20, 2020
* Make ListenerService return Future

Listener service was waiting for the result of the future
in a blocking way and, returning the registration id string.

This is not in line with our other APIs in which we provide
non-blocking API.

Also, the slight behaviour change applied to Java client is
ported to Python client. hazelcast/hazelcast#17646

* add missing .blocking() calls
@sancar sancar added the All Languages Should Check Used by clients team to track fixes on the java client that should potentially backported to others label Jan 20, 2021
@mdumandag mdumandag added All Languages Should Check Used by clients team to track fixes on the java client that should potentially backported to others and removed All Languages Should Check Used by clients team to track fixes on the java client that should potentially backported to others labels Jan 26, 2021
sancar pushed a commit to sancar/hazelcast that referenced this pull request Aug 9, 2021
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Example:
Cache listener count is kept per proxy. When listener is removed,
we decrease the listener count from the cache context.
Since this operation is async, it could be the case that the cache
is destroyed from the calling thread before we decrement the value.
In such cases, we decrement but the incremented value is lost. Therefore,
we can end up with negative values.

The listener derregistration invoctions are not waited. It was
sync but we have changed the behavior as a side affect during
this fix hazelcast#17646

We may solve this only for CacheListener but there could be more
services relying on sync listener removal. Therefore, as a fix,
we wait for invocation answer from the remote.

fixes hazelcast#19269
sancar pushed a commit that referenced this pull request Aug 16, 2021
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Example:
Cache listener count is kept per proxy. When listener is removed,
we decrease the listener count from the cache context.
Since this operation is async, it could be the case that the cache
is destroyed from the calling thread before we decrement the value.
In such cases, we decrement but the incremented value is lost. Therefore,
we can end up with negative values.

The listener derregistration invoctions are not waited. It was
sync but we have changed the behavior as a side affect during
this fix #17646

We may solve this only for CacheListener but there could be more
services relying on sync listener removal. Therefore, as a fix,
we wait for invocation answer from the remote.

fixes #19269
sancar pushed a commit to sancar/hazelcast that referenced this pull request Aug 16, 2021
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Example:
Cache listener count is kept per proxy. When listener is removed,
we decrease the listener count from the cache context.
Since this operation is async, it could be the case that the cache
is destroyed from the calling thread before we decrement the value.
In such cases, we decrement but the incremented value is lost. Therefore,
we can end up with negative values.

The listener derregistration invoctions are not waited. It was
sync but we have changed the behavior as a side affect during
this fix hazelcast#17646

We may solve this only for CacheListener but there could be more
services relying on sync listener removal. Therefore, as a fix,
we wait for invocation answer from the remote.

fixes hazelcast#19269

(cherry picked from commit 1a5baf9)
sancar pushed a commit to sancar/hazelcast that referenced this pull request Aug 16, 2021
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Example:
Cache listener count is kept per proxy. When listener is removed,
we decrease the listener count from the cache context.
Since this operation is async, it could be the case that the cache
is destroyed from the calling thread before we decrement the value.
In such cases, we decrement but the incremented value is lost. Therefore,
we can end up with negative values.

The listener derregistration invoctions are not waited. It was
sync but we have changed the behavior as a side affect during
this fix hazelcast#17646

We may solve this only for CacheListener but there could be more
services relying on sync listener removal. Therefore, as a fix,
we wait for invocation answer from the remote.

fixes hazelcast#19269

(cherry picked from commit 1a5baf9)
(cherry picked from commit 95d9d4b)
sancar pushed a commit to sancar/hazelcast that referenced this pull request Aug 16, 2021
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Example:
Cache listener count is kept per proxy. When listener is removed,
we decrease the listener count from the cache context.
Since this operation is async, it could be the case that the cache
is destroyed from the calling thread before we decrement the value.
In such cases, we decrement but the incremented value is lost. Therefore,
we can end up with negative values.

The listener derregistration invoctions are not waited. It was
sync but we have changed the behavior as a side affect during
this fix hazelcast#17646

We may solve this only for CacheListener but there could be more
services relying on sync listener removal. Therefore, as a fix,
we wait for invocation answer from the remote.

fixes hazelcast#19269

(cherry picked from commit 1a5baf9)
(cherry picked from commit 95d9d4b)
sancar pushed a commit that referenced this pull request Aug 17, 2021
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Example:
Cache listener count is kept per proxy. When listener is removed,
we decrease the listener count from the cache context.
Since this operation is async, it could be the case that the cache
is destroyed from the calling thread before we decrement the value.
In such cases, we decrement but the incremented value is lost. Therefore,
we can end up with negative values.

The listener derregistration invoctions are not waited. It was
sync but we have changed the behavior as a side affect during
this fix #17646

We may solve this only for CacheListener but there could be more
services relying on sync listener removal. Therefore, as a fix,
we wait for invocation answer from the remote.

fixes #19269

(cherry picked from commit 1a5baf9)
sancar pushed a commit that referenced this pull request Aug 17, 2021
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Example:
Cache listener count is kept per proxy. When listener is removed,
we decrease the listener count from the cache context.
Since this operation is async, it could be the case that the cache
is destroyed from the calling thread before we decrement the value.
In such cases, we decrement but the incremented value is lost. Therefore,
we can end up with negative values.

The listener derregistration invoctions are not waited. It was
sync but we have changed the behavior as a side affect during
this fix #17646

We may solve this only for CacheListener but there could be more
services relying on sync listener removal. Therefore, as a fix,
we wait for invocation answer from the remote.

fixes #19269

(cherry picked from commit 1a5baf9)
(cherry picked from commit 95d9d4b)
sancar pushed a commit that referenced this pull request Aug 17, 2021
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Example:
Cache listener count is kept per proxy. When listener is removed,
we decrease the listener count from the cache context.
Since this operation is async, it could be the case that the cache
is destroyed from the calling thread before we decrement the value.
In such cases, we decrement but the incremented value is lost. Therefore,
we can end up with negative values.

The listener derregistration invoctions are not waited. It was
sync but we have changed the behavior as a side affect during
this fix #17646

We may solve this only for CacheListener but there could be more
services relying on sync listener removal. Therefore, as a fix,
we wait for invocation answer from the remote.

fixes #19269

(cherry picked from commit 1a5baf9)
(cherry picked from commit 95d9d4b)
TomaszGaweda pushed a commit to TomaszGaweda/hazelcast that referenced this pull request Sep 7, 2021
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Example:
Cache listener count is kept per proxy. When listener is removed,
we decrease the listener count from the cache context.
Since this operation is async, it could be the case that the cache
is destroyed from the calling thread before we decrement the value.
In such cases, we decrement but the incremented value is lost. Therefore,
we can end up with negative values.

The listener derregistration invoctions are not waited. It was
sync but we have changed the behavior as a side affect during
this fix hazelcast#17646

We may solve this only for CacheListener but there could be more
services relying on sync listener removal. Therefore, as a fix,
we wait for invocation answer from the remote.

fixes hazelcast#19269
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
All Languages Should Check Used by clients team to track fixes on the java client that should potentially backported to others Source: Internal PR or issue was opened by an employee Team: Client Type: Defect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants