Files
Polite_realism 79bcf296cd fix(proxy): retry with backoff on transient accept errors instead of exiting (#2369)
* fix(proxy): retry with backoff on transient accept errors instead of exiting

The proxy accept loop unconditionally broke on any accept() error,
permanently killing the proxy while the sandbox continued to report
Ready. Replace the break with a sleep-and-continue pattern: EMFILE/ENFILE
errors get exponential backoff (100ms to 3.2s) to let file descriptors
drain, and all other accept errors get a fixed 100ms backoff matching
the existing metadata_server and edge_tunnel patterns.

Closes #2337

Signed-off-by: Sean Burdine <sburdine@nvidia.com>
Signed-off-by: politerealism <burdcat17@gmail.com>

* fix(proxy): address review feedback on accept retry backoff

- Use libc::EMFILE / libc::ENFILE instead of raw errno values; promote
  libc from dev-dependency to regular dependency
- Extract accept_backoff() and is_fd_exhaustion_error() into testable
  helpers
- Fix unreachable 5s cap: bump exponent limit from min(6) to min(7) so
  the 5_000ms ceiling is reachable (100 * 2^6 = 6400, capped to 5000)
- Add 6 unit tests covering exponential progression, counter reset,
  saturation at cap, EMFILE/ENFILE detection, and non-FD error rejection

Signed-off-by: Sean Burdine <sburdine@nvidia.com>
Signed-off-by: politerealism <burdcat17@gmail.com>

* fix(proxy): classify accept errors and exit on terminal failures

Three-way error classification for the accept loop: transient errors
(EMFILE, ECONNABORTED) retry with backoff, terminal errors (EBADF,
EINVAL, ENOTSOCK) exit immediately, and unknown errors exit after 5
consecutive failures. Adds unit tests for the classifier and error
handler, plus a subprocess-isolated integration test that validates
EMFILE recovery by lowering RLIMIT_NOFILE.

Signed-off-by: Quinn Burdine <sburdine@redhat.com>
Signed-off-by: politerealism <burdcat17@gmail.com>

* fix(proxy): use nested or-patterns to satisfy clippy lint

Signed-off-by: Quinn Burdine <sburdine@redhat.com>
Signed-off-by: politerealism <burdcat17@gmail.com>

* fix(proxy): expand transient error allowlist and fix clippy/test issues

Widen the accept-error classification to cover all Linux accept(2)
transient errnos (ENETDOWN, EPROTO, ENOPROTOOPT, EHOSTDOWN,
EHOSTUNREACH, EOPNOTSUPP, ENETUNREACH, ENONET behind cfg gate).
Rename fd-exhaustion helpers to resource-pressure to reflect ENOBUFS
and ENOMEM coverage. Fix clippy lints in the integration test
(borrow_as_ptr, collection_is_never_read, while_let_loop) and make
post-EMFILE recovery verification cross-platform by handling Linux's
stale backlog behavior.

Signed-off-by: Quinn Burdine <sburdine@redhat.com>
Signed-off-by: politerealism <burdcat17@gmail.com>

* fix(proxy): add remaining Linux accept(2) transient errnos and make test skip explicit

Classify ENOSR, ESOCKTNOSUPPORT, EPROTONOSUPPORT, and ETIMEDOUT as
transient accept errors per Linux accept(2) documentation. Treat ENOSR
as resource pressure (exponential backoff). Make the EMFILE integration
test skip path emit a diagnostic instead of silently returning success.

Signed-off-by: Quinn Burdine <sburdine@redhat.com>
Signed-off-by: politerealism <burdcat17@gmail.com>

* fix(proxy): panic instead of silent skip when EMFILE is not triggered

The integration test child runs inside Command::output() which captures
stderr. A silent return on the Ok path meant CI would report a passing
test without any diagnostic. Panic instead so the parent test fails
visibly if the platform cannot induce EMFILE.

Signed-off-by: Quinn Burdine <sburdine@redhat.com>
Signed-off-by: politerealism <burdcat17@gmail.com>

---------

Signed-off-by: Sean Burdine <sburdine@nvidia.com>
Signed-off-by: politerealism <burdcat17@gmail.com>
Signed-off-by: Quinn Burdine <sburdine@redhat.com>
2026-07-27 18:15:10 +00:00
..