Skip to content

馃悰 Fix flaky Listener_StopThenStart_KeepsServing - #10

Merged
valentinbreiz merged 1 commit into
mainfrom
fix/flaky-stop-start
Oct 8, 2026
Merged

valentinbreiz merged 1 commit into
mainfrom
fix/flaky-stop-start

Conversation

@valentinbreiz

Copy link
Copy Markdown
Member

CI failed on main (run 37754496626) with ObjectDisposedException from HttpListener.Start() in Listener_StopThenStart_KeepsServing. The same code had passed on the PR run.

The test server's serving thread polls GetContext() every 50 ms. If it wakes between the test's Stop() and Start(), it sees the stop, returns null, and Serve closes the listener, so Start() correctly throws.

TestServer.Restart() now sets a flag around the pair, and Serve waits for it to clear instead of exiting. Test-only change; HttpListener is unchanged.

Seeing the Stop between the two, it returned from GetContext and closed the
listener, and Start threw ObjectDisposedException.
@valentinbreiz
valentinbreiz merged commit b188be6 into main Oct 8, 2026
1 check passed
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.

1 participant