curator icon indicating copy to clipboard operation
curator copied to clipboard

GH-1277 SafeNotifyService threads leak in CuratorFrameWorkImpl

Open fapifta opened this issue 3 months ago • 1 comments

CURATOR-495 introduced a new runSafeService field in CuratorFrameworkImpl class, and this field is either initialized by an external ExecutorService via the builder, or it is created internally within the class.

In the CuratorFrameworkImpl#close method though, this Executor is never closed, so the threads that are opened by the instances are lingering there until the VM is closed by default. Worse, if someone specifies a thread factory to the framework implementation via the builder that produces non-daemon threads, the VM never exits due to the unstopped single thread executor.

fapifta avatar Sep 08 '25 00:09 fapifta

@kezhuw Thank you for your review, I added to the JavaDoc of the Builder#runSafeService method, and changed the approach the close waits for these executors to be closed. I hope the tests now will go through, my understanding is that the failure was not related to the change, but let's see.

fapifta avatar Sep 09 '25 16:09 fapifta

Hi, is there any plan for merging this?

HaoYang670 avatar Dec 18 '25 03:12 HaoYang670

Merged. Thank you all for contribution!

kezhuw avatar Dec 18 '25 04:12 kezhuw