Add socket activation support - #1516
Open
Ericson2314 wants to merge 1 commit into
Open
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
Ericson2314
marked this pull request as draft
August 12, 2026 19:56
Ericson2314
force-pushed
the
socket-activation
branch
from
August 12, 2026 19:57
770624c to
2718b23
Compare
Socket activation is generally nice to have / considered good practice, but this will especially be useful later because it makes parallel local (i.e. via `cabal`, not just inside a Nix build) integration testing easier. We try socket activation by default, falling back to binding a port ourselves. `--socket-activation-only` and `--no-socket-activation` force either side; `--ip`/`--port` imply the latter, since asking for an address to listen on is a request to bind it ourselves. (Use `--base-uri` if you only meant to change the advertised URI.) A key implementation detail: `setNonBlockIfNeeded` must be called on the inherited fd so that GHC's IO manager (epoll) can handle `accept`/`recv` correctly in the threaded runtime. Without this, the server starts but connections hang — discovered and fixed via the NixOS VM integration test.
Ericson2314
force-pushed
the
socket-activation
branch
from
August 12, 2026 20:44
2718b23 to
cc1ce4c
Compare
Ericson2314
marked this pull request as ready for review
August 12, 2026 20:44
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.
Socket activation is generally nice to have / considered good practice, but this will especially be useful later because it makes parallel local (i.e. via
cabal, not just inside a Nix build) integration testing easier.We try socket activation by default, falling back to binding a port ourselves.
--socket-activation-onlyand--no-socket-activationforce either side;--ip/--portimply the latter, since asking for an address to listen on is a request to bind it ourselves. (Use--base-uriif you only meant to change the advertised URI.)A key implementation detail:
setNonBlockIfNeededmust be called on the inherited fd so that GHC's IO manager (epoll) can handleaccept/recvcorrectly in the threaded runtime. Without this, the server starts but connections hang — discovered and fixed via the NixOS VM integration test.