You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harden the thread-pool runtime against connection-exhaustion DoS
Build on the EMFILE backoff with the structural fixes that keep a public
listener solid under load and abuse:
- Bound the connection queue: replace the unbounded mpsc channel with a
sync_channel sized to workers*64 (clamped 256..4096). Each queued stream
holds an fd, so an unbounded queue let a burst exhaust the descriptor
limit; the cap is a generous safety ceiling that stays clear of normal
and ACME-issuance concurrency, with the kernel backlog shedding overflow.
- Add read/write socket timeouts (30s) to every accepted stream. A peer
that connects and stalls (slowloris, dead keep-alive, a client that stops
reading) now releases its worker instead of pinning it forever. TLS rides
the same raw stream, so this covers the handshake too.
- Cap the plain-HTTP redirect listener at 256 concurrent connections so a
flood can't spawn unbounded threads; excess is shed by closing.
- Wrap per-connection handling in catch_unwind so one panicking request
can't kill a worker and slowly drain the pool.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments