Call FastThreadLocal.removeAll() before notify termination future of … (#8666)
Motivation: We should try removing all FastThreadLocals for the Thread before we notify the termination. future. The user may block on the future and once it unblocks the JVM may terminate and start unloading classes. Modifications: Remove all FastThreadLocals for the Thread before notify termination future. Result: Fixes https://github.com/netty/netty/issues/6596.
This commit is contained in:
parent
e2d9665707
commit
6464c98743
@ -939,6 +939,12 @@ public abstract class SingleThreadEventExecutor extends AbstractScheduledEventEx
|
||||
try {
|
||||
cleanup();
|
||||
} finally {
|
||||
// Lets remove all FastThreadLocals for the Thread as we are about to terminate and notify
|
||||
// the future. The user may block on the future and once it unblocks the JVM may terminate
|
||||
// and start unloading classes.
|
||||
// See https://github.com/netty/netty/issues/6596.
|
||||
FastThreadLocal.removeAll();
|
||||
|
||||
STATE_UPDATER.set(SingleThreadEventExecutor.this, ST_TERMINATED);
|
||||
threadLock.release();
|
||||
if (!taskQueue.isEmpty()) {
|
||||
@ -947,7 +953,6 @@ public abstract class SingleThreadEventExecutor extends AbstractScheduledEventEx
|
||||
"non-empty task queue (" + taskQueue.size() + ')');
|
||||
}
|
||||
}
|
||||
|
||||
terminationFuture.setSuccess(null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user