Skip to content

Add socket activation support - #1516

Open
Ericson2314 wants to merge 1 commit into
haskell:masterfrom
Ericson2314:socket-activation
Open

Add socket activation support#1516
Ericson2314 wants to merge 1 commit into
haskell:masterfrom
Ericson2314:socket-activation

Conversation

@Ericson2314

Copy link
Copy Markdown
Contributor

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.

@mergify

mergify Bot commented Aug 12, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@Ericson2314
Ericson2314 marked this pull request as draft August 12, 2026 19:56
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
Ericson2314 marked this pull request as ready for review August 12, 2026 20:44
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