GitHub user hanm opened a pull request:
https://github.com/apache/zookeeper/pull/211
ZOOKEEPER-2743: Netty connection leaks JMX connection bean.
See https://issues.apache.org/jira/browse/ZOOKEEPER-2743 for details on the
symptom and diagnostic.
There are many ways of fixing this. For example we can enforce certain
ordering of the close operations to eliminate the race condition however that
would incur non trivial performance penalty as a result of synchronization. I
think the solution in this patch is simple and effective as it observes that
the bean unregister call is idempotent and the call itself is trivial so we
just always unregister connection upon close the connection, to ensure the bean
is unregistered regardless of the races.
I've also stress tested this solution on internal Jenkins which indicates
no failures of https://issues.apache.org/jira/browse/ZOOKEEPER-2707 for the
past two days.
A side note is NIO connection in theory would suffer the same problem
however I am unable to reproduce the same racing with existing unit test. So I
just leave NIO as it is, for now.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/hanm/zookeeper ZOOKEEPER-2743
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zookeeper/pull/211.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #211
----
commit 7dd916c4c7c8d4e0e83cb5780175058a5626de19
Author: Michael Han <[email protected]>
Date: 2017-04-01T20:37:48Z
ZOOKEEPER-2743: Netty connection leaks JMX connection bean upon connection
close in certain race conditions.
Always unregister connection upon close to prevent connection bean leak
under certain race conditions.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---