Skip to content

Commit

Permalink
Fix #5605 Unblock non container Threads
Browse files Browse the repository at this point in the history
Simplification. Always abort on any pending read or write in completion.
  • Loading branch information
gregw committed Feb 4, 2021
1 parent 096e8b8 commit 39f6f87
Showing 1 changed file with 11 additions and 4 deletions.
Expand Up @@ -455,12 +455,19 @@ public void complete(Callback callback)
LOG.warn("Pending write onComplated {} {}", this, _channel);
// An operation is in progress, so we soft close now
_softClose = true;
// then cancel the operation and abort the channel
CancellationException cancelled = new CancellationException();
_writeBlocker.fail(cancelled);
_channel.abort(cancelled);
// then trigger a close from onWriteComplete
_state = State.CLOSE;

// But if we are blocked or there is more content to come, we must abort
// Note that this allows a pending async write to complete only if it is the last write
if (_apiState == ApiState.BLOCKED || !_channel.getResponse().isContentComplete(_written))
{
CancellationException cancelled = new CancellationException();
_writeBlocker.fail(cancelled);
_channel.abort(cancelled);
_state = State.CLOSED;
}

break;
}
break;
Expand Down

0 comments on commit 39f6f87

Please sign in to comment.