Repository navigation
Bump httpcore/httpcore-nio to 4.4.16 and fix a connection-threading regression it introduces - #119
Open
ThisaraWeerakoon wants to merge 1 commit into
Open
ThisaraWeerakoon wants to merge 1 commit into
ThisaraWeerakoon wants to merge 1 commit into
Conversation
httpcore 4.4 no longer clears the WRITE interest in produceOutput once the session output buffer is drained, so the reactor keeps re-entering it and can read a connection's output buffer while a worker thread is writing a message head into it; reinstate the 4.3.x condition in a shared SynapseNHttpServerConnection used by both branches of the server connection factory and in SynapseNHttpClientConnection. Also switch the integration echo server to ContentType.parse, since 4.4 validates the mime type given to ContentType.create and rejects a full header value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Bumps
httpcore/httpcore-niofrom 4.3.3 (2014) to 4.4.16, and fixes a connection-lifecycleregression that the bump introduces in the
nhttptransport.Why
4.3.3 is 18 releases and ~91 fixes behind. Among other things, 4.4.13+ tightened how outgoing
header values are serialized: embedded carriage-return and line-feed characters within a header
value are now normalized to a single space at write time, rather than passed through verbatim as
4.3.3 does. This brings Synapse's header output closer to what RFC 9112's field-value grammar
expects, and is one of several correctness fixes bundled into this range of releases.
The regression and its fix
In httpcore ≤4.3.x,
DefaultNHttpServerConnection.produceOutputcleared the connection'sWRITEinterest once its output buffer was drained. 4.4 removed that step to support requestpipelining.
nhttpdoesn't pipeline, and it submits a response from a worker thread rather thanthe I/O dispatcher thread — with
WRITEinterest left permanently armed, the dispatcher threadkeeps re-entering
produceOutputand can touch the connection's (non-thread-safe) session outputbuffer at the same time a worker thread is writing a new response into it, corrupting its
position/limit state.
SynapseNHttpServerConnection(new) andSynapseNHttpClientConnectionrestore the 4.3.xWRITE-clearing behavior, on both the server and client side ofnhttpconnections.