Skip to content

Let runServer be stopped on threaded Windows - #4

Merged
thomasjm merged 3 commits into
masterfrom
windows-stoppable-run-server
Dec 3, 2026
Merged

thomasjm merged 3 commits into
masterfrom
windows-stoppable-run-server

Conversation

@thomasjm

@thomasjm thomasjm commented Dec 3, 2026 •

Copy link
Copy Markdown

runServer can't be stopped in a threaded program on Windows. accept there is a blocking foreign call that an async exception can't interrupt, and the accept loop runs under mask_, so cancel waits forever. Without -threaded, accept can be interrupted, which is why master's test suite never hit this.

On Windows, acceptOnSeparateThread runs the loop on its own thread and the caller waits on an MVar. When the caller is interrupted, the bracket closes the listening socket, which ends the loop. Elsewhere nothing changes.

The test suite now runs threaded, and stop the server checks that cancelling runServer returns. On Windows (GHC 9.14, WinIO and MIO) it fails without the fix and passes with it. The full suite otherwise fails only the tests that already fail on master.

Found while checking #3, whose test suite runs threaded.

@thomasjm
thomasjm force-pushed the windows-stoppable-run-server branch from 6f37c8f to 4caf35c Compare December 3, 2026 22:08
@thomasjm
thomasjm merged commit e57a588 into master Dec 3, 2026
0 of 14 checks 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