diff --git a/common/src/main/java/io/netty/util/HashedWheelTimer.java b/common/src/main/java/io/netty/util/HashedWheelTimer.java index 8822ebf4b0..0c0de97092 100644 --- a/common/src/main/java/io/netty/util/HashedWheelTimer.java +++ b/common/src/main/java/io/netty/util/HashedWheelTimer.java @@ -273,6 +273,11 @@ public class HashedWheelTimer implements Timer { if (!workerState.compareAndSet(WORKER_STATE_STARTED, WORKER_STATE_SHUTDOWN)) { // workerState can be 0 or 2 at this moment - let it always be 2. workerState.set(WORKER_STATE_SHUTDOWN); + + if (leak != null) { + leak.close(); + } + return Collections.emptySet(); }