Listener: defer Open frame until peer protocol header is received - #651
Open
alt-Rational wants to merge 1 commit into
Open
Listener: defer Open frame until peer protocol header is received#651alt-Rational wants to merge 1 commit into
alt-Rational wants to merge 1 commit into
Conversation
The listener connection pipelines its AMQP protocol header and Open frame immediately after SASL (OpenPipe state). When both are flushed into a single TCP segment, some clients fail to parse the coalesced bytes and hang until their connection open timeout. This is intermittent and timing dependent (it depends on how the bytes are chunked on the wire), and is reproducible with the Node @azure/service-bus / rhea client opening several connections concurrently against a ConnectionListener. Defer the listener's Open until the peer's protocol header arrives, so the header and Open are sent as separate writes. This matches the more conservative handshake used by brokers such as Azure Service Bus and is transparent to clients that already handle the pipelined case. A new internal virtual Connection.PipelineOpen (default true) controls the behaviour; ListenerConnection overrides it to false. Client connections are unchanged.
Author
|
@microsoft-github-policy-service agree |
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.
Problem
ListenerConnectionpipelines its AMQP protocol header andOpenframeimmediately after SASL (
OpenPipestate). When both are flushed into a singleTCP segment, some clients fail to parse the coalesced bytes and hang until their
connection-open timeout.
It's intermittent and timing-dependent (depends on wire chunking), and is
reproducible with the Node
@azure/service-bus/rheaclient opening severalconnections concurrently against a
ConnectionListener: the client receives theserver's header+open (
peek_size undefined, N) but never advances, then timesout after ~60s.
Fix
Defer the listener's
Openuntil the peer's protocol header arrives, so theheader and
Openare sent as separate writes. This matches the moreconservative handshake used by brokers such as Azure Service Bus and is
transparent to clients that already handle the pipelined case.
A new internal virtual
Connection.PipelineOpen(defaulttrue) controls thebehaviour;
ListenerConnectionoverrides it tofalse. Client connections areunchanged.
Verification
Built a broker on
ConnectionListenerand ran the Node SDK opening 2 clients ×(2 senders + 2 receivers), 20 msgs each, repeatedly. Before: runs after the
first reliably hang with
operation timeout/negotiateCbs. After: every runsucceeds.