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
37e471dbe6
commit
71430d8bbd
@ -911,6 +911,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()) {
|
||||
@ -919,7 +925,6 @@ public abstract class SingleThreadEventExecutor extends AbstractScheduledEventEx
|
||||
"non-empty task queue (" + taskQueue.size() + ')');
|
||||
}
|
||||
}
|
||||
|
||||
terminationFuture.setSuccess(null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user