Gregory Chanan created ZOOKEEPER-2100:
-----------------------------------------
Summary: ZooKeeperSaslClient doesn't shut down Login thread
Key: ZOOKEEPER-2100
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2100
Project: ZooKeeper
Issue Type: Bug
Components: java client
Affects Versions: 3.4.5
Reporter: Gregory Chanan
I found this in 3.4.5, but a quick perusal of the code suggests this exists in
later versions as well.
Setup: I'm running some ZooKeeper SASL tests with Hadoop's MiniKDC under Solr's
test framework, which checks for things like thread leaks. The thread leak
checker is complaining about the Login thread, which is created but never shut
down. It's started here:
https://github.com/apache/zookeeper/blob/6ebd23b32d2cf606e01906bee4460bf79eb7f3fa/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java#L227
and you can verify via reading the code that it is never shut down.
This may be intentional, because the Login object is static, so it is probably
supposed to stick around for the lifetime of the application. This is not
great for a test setup, where the idea is that a cluster and all associated
clients are started/stopped for each test suite. You wouldn't want either:
1) a thread stick around doing nothing, or
2) sticking around doing something (because it makes the first suite that
happens to run behave differently than subsequents suites).
in addition, this only happens with SASL clients, so we'd want to only turn off
the leak checker if we are running under SASL (so we don't miss other leaked
threads), which is a bit more complexity than I would like.
I'd be happy with a function I could call to say "I'm really done, close down
everything, even in the Login thread" or some automatic way of doing it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)