Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discard new writes without closing connection on AbortWritesEvent #3102

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

idelpivnitskiy
Copy link
Member

@idelpivnitskiy idelpivnitskiy commented Nov 13, 2024

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 test ConnectionCloseHeaderHandlingTest.PipelinedRequestsTest.serverCloseSecondPipelinedRequestWriteAborted that we had to disable in #3097 to proceed with the upgrade.
Debugging showed that when we receive AbortWritesEvent, the following behavior of WriteStreamSubscriber depends on how many activeWrites we have. With 4.1.115 netty will flush data, there will be 0 activeWrites 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:

  • Use listenerDiscard instead of channelClosed that will make sure new writes will be discarded without prematurely affecting the connection state regardless of the activeWrites count.
  • Unskip the test.

Result:

Graceful handling of connection: close header does not depend on flushing behavior.

@idelpivnitskiy idelpivnitskiy changed the title Test 3: Netty 4.1.115, listenerDiscard, unskip test Discard new writes without closing connection on AbortWritesEvent Nov 13, 2024
@idelpivnitskiy idelpivnitskiy marked this pull request as ready for review November 13, 2024 23:41
Copy link
Contributor

@chrisvest chrisvest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good from the description. I can't tell if the close outbound is delayed, or just doesn't happen, though.

@idelpivnitskiy idelpivnitskiy merged commit 4187c05 into apple:main Nov 14, 2024
11 checks passed
@idelpivnitskiy idelpivnitskiy deleted the test3 branch November 14, 2024 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants