Discard new writes without closing connection on AbortWritesEvent
#3102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
Behavior of
SslHandler
in Netty 4.1.115 changed. Now it can wrap data and flush them to the network even if flush was not requested. In result, it affected our testConnectionCloseHeaderHandlingTest.PipelinedRequestsTest.serverCloseSecondPipelinedRequestWriteAborted
that we had to disable in #3097 to proceed with the upgrade.Debugging showed that when we receive
AbortWritesEvent
, the following behavior ofWriteStreamSubscriber
depends on how manyactiveWrites
we have. With 4.1.115 netty will flush data, there will be 0activeWrites
and it will close (with reset) the outbound. In result, we lose data of the previous response in the pipeline that we haven't read yet.Modifications:
listenerDiscard
instead ofchannelClosed
that will make sure new writes will be discarded without prematurely affecting the connection state regardless of theactiveWrites
count.Result:
Graceful handling of
connection: close
header does not depend on flushing behavior.