Fix[TcpBrokerConnection]: desync of bmqEvents - #91
Open
678098 wants to merge 1 commit into
Open
Conversation
678098
force-pushed
the
260724_desync_bmqEvents
branch
from
July 24, 2026 20:06
15c19c3 to
2544b55
Compare
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
678098
force-pushed
the
260724_desync_bmqEvents
branch
from
July 24, 2026 20:07
2544b55 to
8f828fe
Compare
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
handleAuthenticationResponse()andhandleNegotiationResponse()early-return when their timeout futureisDone()before pollingbmqEvents. But the triggering event was alreadyput()onto the queue inaddBmqEvent(), so it is never drained. This desyncs the queue (off-by-one): a subsequent BlazingMQ event during NEGOTIATING/AUTHENTICATING then polls the stale event instead of the current one, causing it to be misread.cancel()also setsisDone(), so this can trigger when a second event arrives right after the first is processed.Fix
Reorder both handlers to poll
bmqEventsfirst, then check the timeout. The triggering event is always drained regardless of timeout state.Tests
Added two regression tests in
TcpBrokerConnectionReauthTest(testNegotiationResponseDrainsEventWhenTimeoutDone,testAuthenticationResponseDrainsEventWhenTimeoutDone) that assert the handler drains its triggering event when the timeout future is already done.