Fix #5605 Unblock non container Threads

Simplification. Always abort on any pending read or write in completion.
This commit is contained in:
gregw 2021-02-04 10:26:11 +01:00
parent 096e8b83e9
commit 39f6f87ca7
1 changed files with 11 additions and 4 deletions

View File

@ -455,12 +455,19 @@ public class HttpOutput extends ServletOutputStream implements Runnable
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
// 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);
// then trigger a close from onWriteComplete
_state = State.CLOSE;
_state = State.CLOSED;
}
break;
}
break;