Skip to content

refactor(core): remove inert maxServeErrors option (#278) - #308

Merged
momics merged 1 commit into
mainfrom
momics-wire-max-serve-errors
Jul 6, 2026
Merged

refactor(core): remove inert maxServeErrors option (#278)#308
momics merged 1 commit into
mainfrom
momics-wire-max-serve-errors

Conversation

@momics

@momics momics commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

maxServeErrors was documented as "consecutive accept-loop errors before the serve loop terminates (default 5)" and plumbed from the JS API through every adapter into core ServeOptions.max_serve_errors — but the accept loop never consumed it (#278).

Per maintainer decision, this removes the option entirely rather than wiring it.

Why remove instead of wire

In iroh, Endpoint::accept() returns Option (None = endpoint closed, already handled), so the only accept-loop error is a per-connection QUIC handshake failure. Terminating the serve loop on a run of those would let any peer kill a server with a short burst of connection resets — a trivial DoS — and directly contradicts the existing accept_loop_survives_connect_reset_flood resilience invariant (which requires the loop to survive exactly that). There is no safe systemic-error surface for the option to act on, so it was dead weight.

Changes

  • Core: dropped max_serve_errors from ServeOptions (options.rs) and the serve_options_defaults assertion (endpoint.rs).
  • Adapters (core→adapter ripple): removed the field from node (src/lib.rs + generated index.d.ts), deno (dispatch.rs), tauri (commands.rs + guest-js/index.ts), and iroh-http-shared (IrohAdapter.ts, serve.ts).
  • Docs: removed from specification.md, tuning.md, server-limits.md.
  • Untouched: tests/resilience.rs::accept_loop_survives_connect_reset_flood stays as the invariant.

No behavior change (the option was inert). grep confirms zero remaining maxServeErrors/max_serve_errors references.

Verification

npm run ciAll checks passed (fmt, clippy, rust/tauri/node/deno tests, interop). Build churn reverted (index.js codegen, deno.lock); package-lock.json clean. No version-field bumps.

Closes #278

`maxServeErrors` was documented as "consecutive accept-loop errors before
the serve loop terminates (default 5)" and plumbed from the JS API through
every adapter into core `ServeOptions.max_serve_errors`, but the accept
loop never consumed it.

Wiring it turns out to be unsafe: in iroh, `Endpoint::accept()` returns
`Option` (`None` = endpoint closed, already handled), so the only
accept-loop error is a per-connection QUIC handshake failure. Terminating
the loop on a run of those would let any peer kill a server with a short
burst of connection resets — a trivial DoS — and directly contradicts the
`accept_loop_survives_connect_reset_flood` resilience invariant. There is
no safe systemic-error surface for the option to react to, so it is dead
weight.

Remove it entirely: core `ServeOptions`, the node/deno/tauri adapter
serve-option shapes, the `iroh-http-shared` types, the docs (spec, tuning,
server-limits), and the `serve_options_defaults` assertion. No behavior
change (the option was inert); the resilience invariant is untouched.

Closes #278

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@momics
momics force-pushed the momics-wire-max-serve-errors branch from 1a4b252 to 3fffb10 Compare July 6, 2026 14:15
@momics momics changed the title feat(core): terminate serve loop after max_serve_errors consecutive accept errors (#278) refactor(core): remove inert maxServeErrors option (#278) Jul 6, 2026
@momics
momics merged commit a13129f into main Jul 6, 2026
7 checks passed
@momics
momics deleted the momics-wire-max-serve-errors branch July 20, 2026 08:56
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.

Wire or remove the unused maxServeErrors accept-loop option

1 participant