In order to trigger the thread leak, have nerve running with a few services, watch the number of threads for the nerve process, then kill zookeeper instances (wait for 30secs timeout for ZK ping). Then relaunch ZK and watch the thread count. It will grow by 2 per process.
This fixes the thread leak by joining the reconnect thread when Zookeeper goes down.
Zookeeper client spawns a reconnect thread that is not killed when zk.close is called, but it is only killed when zk.close! (https://github.com/zk-ruby/zk/blob/master/lib/zk/client/threaded.rb#L332) is called.
In order to trigger the thread leak, have nerve running with a few services, watch the number of threads for the nerve process, then kill zookeeper instances (wait for 30secs timeout for ZK ping). Then relaunch ZK and watch the thread count. It will grow by 2 per process.
This fixes the thread leak by joining the reconnect thread when Zookeeper goes down.