Skip to content

test: fix race in TestBridge_FullReconnectCycle#2822

Merged
anmaxvl merged 1 commit into
microsoft:mainfrom
anmaxvl:fix-bridge-reconnect-test-race
Jul 13, 2026
Merged

test: fix race in TestBridge_FullReconnectCycle#2822
anmaxvl merged 1 commit into
microsoft:mainfrom
anmaxvl:fix-bridge-reconnect-test-race

Conversation

@anmaxvl

@anmaxvl anmaxvl commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

The iteration-1 writer goroutine ranged over b.responseChan directly, so the field was read lazily when the goroutine was scheduled. If that happened after iteration 2 reassigned b.responseChan, the leftover goroutine bound to the new channel and consumed the drained "between" notification, making the test's receive time out.

Capture the channel in a local variable so the goroutine is bound to iteration 1's channel regardless of later reassignment.

The iteration-1 writer goroutine ranged over b.responseChan directly, so
the field was read lazily when the goroutine was scheduled. If that
happened after iteration 2 reassigned b.responseChan, the leftover
goroutine bound to the new channel and consumed the drained "between"
notification, making the test's receive time out.

Capture the channel in a local variable so the goroutine is bound to
iteration 1's channel regardless of later reassignment.

Signed-off-by: Maksim An <maksiman@microsoft.com>
@anmaxvl anmaxvl requested a review from a team as a code owner July 13, 2026 06:21
@anmaxvl anmaxvl merged commit 734dd3d into microsoft:main Jul 13, 2026
20 checks passed
@anmaxvl anmaxvl deleted the fix-bridge-reconnect-test-race branch July 13, 2026 16:33
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