Repository navigation
docs(daemon): correct two comments that still describe the deleted acceptor threads - #7717
Merged
Merged
Conversation
…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.
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.
docs(daemon): correct two comments that still describe the deleted acceptor threads
PR #7681 collapsed the portable accept engines into one
PollAcceptEnginethat polls every listener fd from the accept thread, and deleted
MultiListenerEnginealong with its per-listener acceptor threads. Twocomments 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_familysaid the SO_REUSEPORT replicas were "each drivenby its own acceptor thread".
accept_engine.rssays the opposite four filesaway: "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 atconnection.rs:224.
RuntimeOptions::acceptor_threadscarried a second claim that is now wrongin 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_forkmay only be called from asingle-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: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.