Fix possible deadlock in DefaultChannelPipeline.destroyDown(...)

Motivation:

We need to ensure we not hold a lock while executor callHandlerRemoved(...) as this may lead to a deadlock if handlerRemoved(...) will call another method in DEfaultChannelPipeline from another thread that will need to obtain the lock as well and wait for the result.

Modifications:

Release the lock before call handlerRemoved0(...).

Result:

No more deadlock possible
This commit is contained in:
Norman Maurer 2016-05-30 20:45:37 +02:00
parent f8b306f61c
commit e847ac0443

View File

@ -858,8 +858,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
if (inEventLoop || executor.inEventLoop(currentThread)) {
synchronized (this) {
remove0(ctx);
callHandlerRemoved0(ctx);
}
callHandlerRemoved0(ctx);
} else {
final AbstractChannelHandlerContext finalCtx = ctx;
executor.execute(new OneTimeTask() {