Files
Polite_realism 60a9b4dc62 fix(ssh): add EMFILE backoff and exit notification to SSH accept loop (#2705)
Apply the same two-layer defense from the proxy accept loop (#2369/#2370)
to the SSH accept loop: classify transient vs terminal accept errors with
exponential backoff on EMFILE/resource-exhaustion, and notify the sandbox
when the accept loop exits so the container terminates instead of running
without SSH access.

- Add SshAcceptAction enum and classify_ssh_accept_error in ssh.rs,
  mirroring the proxy pattern (EMFILE/ENFILE/ENOBUFS → Retry with
  backoff, unknown errors → Terminal after 10 consecutive failures)
- Replace the bare accept().await in run_ssh_server with a classify-and-
  retry loop; resets consecutive-error counter on each successful accept
- Thread ssh_exit_tx: Option<oneshot::Sender<()>> through run_process;
  hold it as a drop-guard inside the SSH spawn so the receiver fires when
  the task ends for any reason
- Wire ssh_exited future in lib.rs (created only when ssh_socket_path is
  Some) and select! on it in both process_enabled paths, returning an
  error so the sandbox container restarts

Closes #2372

Signed-off-by: politerealism <burdcat17@gmail.com>
2026-08-25 21:07:10 +00:00
..