Skip to content

feat: single-threaded poll reactor with graceful shutdown - #7

Merged
AgentDudu merged 1 commit into
developfrom
feature/reactor-single-thread
Oct 20, 2026
Merged

AgentDudu merged 1 commit into
developfrom
feature/reactor-single-thread

Conversation

@AgentDudu

Copy link
Copy Markdown
Owner

Reactor (R, single-thread slice): poll loop, connection state machine, 408 deadlines, POLLOUT backpressure, graceful drain. Signals per OS: Linux self-pipe, Windows console-ctrl + poll cap. Integration tests over real sockets (200/keep-alive/400/408/stop).

Gates: Windows ck.ps1 green; Linux container ASan green + new SIGINT-exit-0 smoke; TSan green locally with vm.mmap_rnd_bits=28 — CI job runs it native for that reason.

…signals

server::Server reactor (accept batch, deadline table -> 408, POLLOUT backpressure, drain-then-drop stop with grace cap) + server::Connection (socket + RequestParser + out buffer; protocol errors answered once best-effort then dropped). Connection stays reactor-owned; no shared state yet.

app::ShutdownSignals: Linux self-pipe (pipe2, instant poll wake); Windows console-control handler sets flag and blocks until notifyStopped (a returning handler means exit-now), reactor pollCap 100ms. CMake TSAN option; CI linux-tsan job (native runner: kernel containers cannot set vm.mmap_rnd_bits TSan needs). SIGINT graceful-stop smoke added to the container gate.

Traps: TSan FATALs on kernel 6.x containers (unexpected memory mapping) until vm.mmap_rnd_bits=28; accepted-socket index bug — new conns join next poll, not the live fd set; test race where stop beat accept (backlog RST != EOF) fixed by serving one request first.
@AgentDudu
AgentDudu merged commit 1d18f27 into develop Oct 20, 2026
3 checks passed
@AgentDudu
AgentDudu deleted the feature/reactor-single-thread branch October 20, 2026 09:11
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