Repository navigation
Commit 6c7d0a7
committed
fix(sandbox): read exec pipes and PTY masters without blocking pool threads
Exec stdin/stdout/stderr and the PTY master were wrapped in
tokio::fs::File, so every pending read on an idle pipe parked one tokio
blocking-pool thread until data arrived or the peer closed. That pool is
shared with the control plane (gRPC exchange, exec spawn/reap,
AcceptNetwork), and enough idle exec sessions exhausted it, blocking new
control connections.
Adopt the descriptors with a readiness-based AsyncFd adapter instead:
reads and writes only run when the descriptor is ready, and idle execs
park no pool threads. Flush and shutdown keep the tokio::fs::File
semantics the consumers were written against, and close-on-drop remains
the EOF mechanism, so no consumer changes.
An isolated boundary test caps the blocking pool at 16 threads, starts
12 idle execs, and asserts a fresh exec and a control request still
complete; without the fix it fails when the sixth idle exec stalls.
Signed-off-by: Emilien Macchi <emacchi@redhat.com>1 parent 32dcc4a commit 6c7d0a7
3 files changed
Lines changed: 559 additions & 23 deletions
0 commit comments