Skip to content

test(network): fix flaky Test_conn_startSending - #4431

Open
stevenvegt wants to merge 1 commit into
V5.4from
fix/flaky-conn-test-v5.4
Open

test(network): fix flaky Test_conn_startSending#4431
stevenvegt wants to merge 1 commit into
V5.4from
fix/flaky-conn-test-v5.4

Conversation

@stevenvegt

Copy link
Copy Markdown
Member

Summary

Test_conn_startSending/disconnect_does_not_panic flaked on CI (seen on #4425): it cancelled the stream before calling disconnect(), racing the receive goroutine (which stores the stream error as close status, codes.Unknown) against disconnect() cancelling the connection context. Whichever won determined whether the final codes.OK assertion passed.

Reordering to disconnect first guarantees the connection context is cancelled before RecvMsg returns, so the receive loop deterministically drops the message without storing a status. This keeps the test's goroutine-exit and no-panic coverage, which master lost when it deleted the test entirely in #2618. Companion PRs re-add the fixed test on master and V6.2.

Verified with go test -race -count=100: 100/100 pass.

Assisted-by: AI

The test cancelled the stream before calling disconnect(), racing the
receive goroutine (which stores the stream error as close status)
against disconnect() cancelling the connection context. Disconnecting
first guarantees the context is cancelled before RecvMsg returns, so
the receive loop deterministically takes the drop-message path. Master
removed this test entirely (#2618); this keeps the goroutine-exit and
no-panic coverage instead. Verified with -race -count=100.

Assisted-by: AI
@qltysh

qltysh Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Qlty


Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant