Skip to content

fix(io): a metered origin keeps its pinned redirect target (#307 follow-up) - #323

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/307-followup
Aug 7, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/307-followup

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Follow-up to #308 (merged). Re #307, which stays open until the reporter retests on the device.

The pin and rate limiting. #308 dropped the post-redirect pin after two consecutive failures of either kind, including a 429/503 streak, while its own rationale (and the CHANGELOG entry) says a metered origin keeps it. Metering says the origin is refusing requests right now, not that the redirect target is dead (#71), and re-resolving sends the retry back through the source URL for a fresh redirect: a second request against the origin that is already refusing them. On the max_connections=1 panel behind #307 that is exactly the request there is no room for. The hard-5xx arm and the zero-progress arm are unchanged.

Test-origin double close. The new dropConnection directive did shutdown + close on a descriptor that stays in _connFDs, and stop() closes every fd in there. Between the two, the process can hand that descriptor number to a new socket, and stop() would then shut down whatever took it over. Deregister first, then close once.

Test plan

  • New: a rate-limited refill keeps the pin instead of re-resolving through the source (302 source to CDN, CDN meters the first two boundary attempts, then serves). Fails on the pre-follow-up condition (the source sees a boundary hit), passes now. Its suite gained .serialized because it mutates the backoff-scale hook.
  • swift test on macOS 26: 1545 tests / 230 suites green.
  • Reverting each fix(avio): bound reconnects for error-ended zero-byte connections #308 arm was checked against its test before the merge: the refused-refill test runs past its two-minute limit with the reposition guard reverted (the read never returns, which is the field symptom), and the fallback test never reaches the source URL with the pin invalidation reverted.

…ow-up)

The #308 ladder dropped the post-redirect pin on a rate-limit streak as well as
on a zero-progress one. 429/503 says the origin is metering us, not that the
redirect target is dead (#71), and re-resolving sends the retry back through the
source URL for a fresh redirect: a second request against the origin that is
already refusing them. On the connection-capped panel behind #307 that is the
request there is no room for. The hard-5xx arm and the zero-progress arm are
unchanged, and the metered case has a test now.

Also fixes a double close in the new `ThrottledOriginServer` dropConnection
directive: `serve` leaves closing to `stop()`, which closes every fd still in
`_connFDs`, so closing there frees a descriptor number the process can hand to
the next socket before `stop()` runs.

Re #307.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
@superuser404notfound
superuser404notfound merged commit daf922d into main Aug 7, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the fix/307-followup branch August 7, 2026 09:35
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.

1 participant