Does Couchbase Java SDK 3.3.0's shutdown hook reliably release Netty EventLoopGroups under high connection churn in containerized deployments?
0 reputation · 07 May 2023, 04:03 UTC
Context
Couchbase Java SDK 3.0–3.2.x leaked Netty EventLoopGroups when applications repeatedly created and closed Cluster instances without calling disconnect(). Version 3.3.0 added an automatic shutdown hook and improved cleanup in ClusterEnvironment to mitigate the leak.
Uncertainty
- The shutdown hook relies on JVM shutdown hooks, which may not run when a container receives SIGKILL (common in Kubernetes).
- Netty's built‑in leak detection must be enabled explicitly (
-Dio.netty.leakDetection.level=advanced) to surface leaks during testing. - It is unclear whether the SDK's internal leak detection reliably catches every EventLoopGroup leak under rapid connection churn.
Questions
Does the automatic shutdown hook guarantee release of all EventLoopGroups when the process is terminated abruptly?
Can Netty leak detection be trusted to report every leak in a high‑churn scenario without false negatives?
What additional safeguards, if any, are recommended for containerized deployments beyond explicit disconnect() calls?