Skip to content

docs(daemon): correct two comments that still describe the deleted acceptor threads - #7717

Merged
oferchen merged 1 commit into
masterfrom
docs/acceptor-threads-comment-fossils
Sep 6, 2026
Merged

oferchen merged 1 commit into
masterfrom
docs/acceptor-threads-comment-fossils

Conversation

@oferchen

@oferchen oferchen commented Sep 6, 2026

Copy link
Copy Markdown
Owner

docs(daemon): correct two comments that still describe the deleted acceptor threads

PR #7681 collapsed the portable accept engines into one PollAcceptEngine
that polls every listener fd from the accept thread, and deleted
MultiListenerEngine along with its per-listener acceptor threads. Two
comments were left behind describing the mechanism that no longer exists,
and they sit on exactly the surface a reader consults to reason about
whether the accept path is single-threaded.

bind_listeners_per_family said the SO_REUSEPORT replicas were "each driven
by its own acceptor thread". accept_engine.rs says the opposite four files
away: "Both engines are single-threaded, so the accept path spawns no threads
of [its] own." Only one of those can be true, and the engine's is the live
one - grep -rn "spawn" crates/daemon/src/daemon/sections/server_runtime/
finds exactly one production thread::spawn, the per-connection worker at
connection.rs:224.

RuntimeOptions::acceptor_threads carried a second claim that is now wrong
in a way an operator can act on: that the replicas distribute "inbound
connection load across CPUs". They do not. The kernel still chooses which
socket receives each connection, but one thread accepts them all, so the
directive spreads accept queues rather than work. Setting it above 1 buys no
CPU parallelism today. Stating that plainly is better than leaving a
performance promise the engine cannot keep.

Both replacements name the reason the engine is single-threaded rather than
just asserting it: platform::session_fork may only be called from a
single-threaded accept path, because a child forked from a multithreaded
parent can deadlock on an allocator lock held by a thread that does not exist
in the child. That is the constraint the deleted threads violated, and it is
why these comments must not drift back.

Measured, not inferred - a daemon built from a tree carrying the current
engine, dual-stack with acceptor threads = 3:

/proc/<pid>/task -> 1 thread
/proc/<pid>/fd   -> 6 listener sockets

Six listener fds, one thread. A build predating #7681 reports 4 threads for
the same config, which is what makes this a comment defect rather than a
behaviour one.

Comment-only: no code, no test, and no behaviour changes.

…ceptor threads

PR #7681 collapsed the portable accept engines into one `PollAcceptEngine`
that polls every listener fd from the accept thread, and deleted
`MultiListenerEngine` along with its per-listener acceptor threads. Two
comments were left behind describing the mechanism that no longer exists,
and they sit on exactly the surface a reader consults to reason about
whether the accept path is single-threaded.

`bind_listeners_per_family` said the SO_REUSEPORT replicas were "each driven
by its own acceptor thread". `accept_engine.rs` says the opposite four files
away: "Both engines are single-threaded, so the accept path spawns no threads
of [its] own." Only one of those can be true, and the engine's is the live
one - `grep -rn "spawn" crates/daemon/src/daemon/sections/server_runtime/`
finds exactly one production `thread::spawn`, the per-connection worker at
connection.rs:224.

`RuntimeOptions::acceptor_threads` carried a second claim that is now wrong
in a way an operator can act on: that the replicas distribute "inbound
connection load across CPUs". They do not. The kernel still chooses which
socket receives each connection, but one thread accepts them all, so the
directive spreads accept queues rather than work. Setting it above 1 buys no
CPU parallelism today. Stating that plainly is better than leaving a
performance promise the engine cannot keep.

Both replacements name the reason the engine is single-threaded rather than
just asserting it: `platform::session_fork` may only be called from a
single-threaded accept path, because a child forked from a multithreaded
parent can deadlock on an allocator lock held by a thread that does not exist
in the child. That is the constraint the deleted threads violated, and it is
why these comments must not drift back.

Measured, not inferred - a daemon built from a tree carrying the current
engine, dual-stack with `acceptor threads = 3`:

    /proc/<pid>/task -> 1 thread
    /proc/<pid>/fd   -> 6 listener sockets

Six listener fds, one thread. A build predating #7681 reports 4 threads for
the same config, which is what makes this a comment defect rather than a
behaviour one.

Comment-only: no code, no test, and no behaviour changes.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 6, 2026
@oferchen
oferchen merged commit 6466d96 into master Sep 6, 2026
78 checks passed
@oferchen
oferchen deleted the docs/acceptor-threads-comment-fossils branch September 6, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant