Skip to content

docs(design): DASYNC.1 daemon accept loop + worker spawn inventory - #5624

Merged
oferchen merged 1 commit into
masterfrom
docs/dasync-1-daemon-accept-loop-inventory
Jun 10, 2026
Merged

oferchen merged 1 commit into
masterfrom
docs/dasync-1-daemon-accept-loop-inventory

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Key findings

  • The synchronous accept loop is serve_connections() at crates/daemon/src/daemon/sections/server_runtime/accept_loop.rs:11, with the worker spawn at crates/daemon/src/daemon/sections/server_runtime/connection.rs:189 spawn_connection_worker() using std::thread::spawn + std::panic::catch_unwind (no Builder::stack_size).
  • A hybrid tokio-accept + sync-worker skeleton already exists at crates/daemon/src/async_listener.rs:73 run_hybrid_listener() behind the async-daemon feature, but the worker closure at crates/daemon/src/daemon.rs:411-418 drops on accept instead of dispatching to handle_session(). DASYNC.3 needs to wire the real SyncWorker.
  • Two distinct feature flags exist (async and async-daemon); DASYNC.2 must decide whether to collapse them.
  • refuse_if_at_capacity() at connection.rs:124 runs after TLS wrap and before worker spawn; under the async target shape this should become a tokio Semaphore / bounded mpsc so the accept loop awaits permits instead of refusing eagerly (eager refusal must remain available for byte-exact @ERROR: wire parity).
  • Per-thread stack ceiling at N=10K matches the documented D10K-6 cliff: Linux 80 GiB VA, Windows 10 GiB VA, macOS 5 GiB VA; bounded by vm.max_map_count = 65530 on Linux 64-bit.

Cross-references

  • [[project_daemon_10k_conn_ceiling]] - thread-per-conn ceiling gating DASYNC.5.
  • [[project_russh_spawn_blocking_ceiling]] - shared spawn_blocking bridge ceiling for DASYNC.3 wiring.
  • [[project_no_async_threaded_only]] - confirms the inventoried baseline is the current default.

Test plan

  • Audit-only change; no production code modified.
  • All file:line anchors verified against the tree at the audit commit.
  • No references to internal tooling in the doc.

Inventory the synchronous, thread-per-connection daemon accept loop
with file:line anchors for the listener bind, accept loop body, worker
spawn primitive, per-connection state hand-off, TLS/LSM/--max-connections
overlays, and worker cleanup. Audit-only; unblocks DASYNC.2 (#3983) design
of the tokio-based async listener and DASYNC.5 (#3986) 5K/10K bench that
closes D10K-3/4/5.
@oferchen
oferchen force-pushed the docs/dasync-1-daemon-accept-loop-inventory branch from 2632645 to 33eab86 Compare June 10, 2026 19:39
@oferchen
oferchen merged commit 0465a78 into master Jun 10, 2026
8 checks passed
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jun 10, 2026
@oferchen
oferchen deleted the docs/dasync-1-daemon-accept-loop-inventory branch June 11, 2026 03:11
oferchen added a commit that referenced this pull request Aug 24, 2026
…5624)

Inventory the synchronous, thread-per-connection daemon accept loop
with file:line anchors for the listener bind, accept loop body, worker
spawn primitive, per-connection state hand-off, TLS/LSM/--max-connections
overlays, and worker cleanup. Audit-only; unblocks DASYNC.2 (#3983) design
of the tokio-based async listener and DASYNC.5 (#3986) 5K/10K bench that
closes D10K-3/4/5.
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