Repository navigation
An idle pin is dropped by its first refusal, not by the grace (#392) - #393
Merged
Merged
Conversation
#392) The keep-pin grace exists for one shape, #307's lingering slot: a connection-capped panel answers 509 while the slot of the connection this reader just replaced is still occupied server-side. That shape requires a byte of ours to have been in flight moments ago. A pin that has carried nothing for `pinIdleRepinSecondsDefault` cannot be producing it. The pump ends its connection at the window high water, so an idle reader holds nothing at the origin for a slot to linger on (#310), and what refuses there is the expired lease of #380. The grace then only delays finding out: three paced attempts against an address that will refuse all of them, 12.5 s of media time in the 6.30.0 retest, free that time only because 16 MB of read-ahead absorbed them. So past the idle gap the first rate-limited refusal drops the pin, and the re-resolve is not paced behind a backoff charged to the address it is no longer using (a server-sent Retry-After still applies, since the source is the same origin). A pin that is still alive pays nothing: this changes only what happens after a refusal, never how a healthy request is issued. Three supporting pieces: - The idle clock is a wall clock stamped in `addBytesFetched`, i.e. at every path that crosses the network and no path that serves from memory. It has to be its own field: `lastDeliveryAt` is rebased by `startPersistentConnection` and therefore always reads as fresh when a refusal is being judged. Wall time rather than uptime, because a lease expires in wall time and a device that slept through the gap has let it expire too. - The pin rungs of both reconnect ladders move into one method, which they were carrying as two copies of the same policy. - The detour's rate-limit arm gets the same rungs. It fetches through the same pinned target and carried no rung at all, so a pin whose lease had died could only be given up on there (a failed read), never re-resolved, and it is the arm a backward read after a long pause lands on. Reported by tschuegy in the 6.30.0 retest of #380, whose trace also answered the open question there: the re-resolved target is the SAME edge host. What dies across an idle is not the address but the authorization behind it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01E5UztmCZtNYPQpzdmSdmWG
…te (#392) CI failed it where a local run passes: 0 refusals instead of 1, with the read still reaching its target. The test paused by not reading and assumed 900 ms was long enough for the pump to fill a 16 MB window and end at the high water. On a loaded runner it is not, and the consequence is not a slower test but a different one: the opening connection was still running when the lease was armed, and a request already in flight is never re-offered to the origin's gate, so every byte the test read came from the connection that predated the fault. It now waits for an EVENT instead. A bounded first fetch makes the opening connection end because its range was delivered IN FULL, so what the origin will ever write at open is a fixed number (the range plus the speculative 64 KB suffix), and the range cannot overrun its bound. A loaded machine delays that number, it cannot change it. Every remaining wait is a lower bound, so slowness only makes the pin more idle, never less, and a suffix probe that never happened fails the test with a message rather than passing it quietly. Verified 12/12 with the machine's cores saturated, where the old shape is the one CI took. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01E5UztmCZtNYPQpzdmSdmWG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #392.
The keep-pin grace answers one shape, #307's lingering slot: a connection-capped panel answers 509 while the slot of the connection this reader has just replaced is still occupied server-side. That shape requires a byte of ours to have been in flight moments ago.
A pin that has carried nothing for a minute cannot be producing it. The pump ends its connection at the window high water, so an idle reader holds nothing at the origin for a slot to linger on (#310), and what refuses there is the expired lease of #380. The grace then only delays finding out: three paced attempts against an address that will refuse every one of them, which was 12.5 s of media time in tschuegy's 6.30.0 retest, free only because 16 MB of read-ahead absorbed it. The same pause taken right after a seek is visible.
So past the idle gap the first rate-limited refusal drops the pin, and the re-resolve is not paced behind a backoff charged to the address it is no longer using (a server-sent
Retry-Afterstill applies, since the source is the same origin). A pin that is still alive pays nothing: this changes only what happens after a refusal, never how a healthy request is issued. That is why it is here rather than the stronger form the retest suggested, which would spend an idle pin through the source preemptively and pay a portal round trip on every resume, including the common one where the pin is fine.What is in it
addBytesFetched, i.e. at every path that crosses the network and no path that serves from memory. It has to be its own field:lastDeliveryAtis rebased bystartPersistentConnectionand therefore always reads as fresh at the moment a refusal is being judged. Wall time rather than uptime, because a lease expires in wall time and a device that slept through the gap has let it expire too.Test
an idle pin is dropped by its FIRST refusal instead of riding out the grace, in the existing.serializedsuite. The origin mints a numbered lease per resolve; the test lets the pump fill the window and end at the high water, then stops reading (the reader is pull-driven, so a consumer that stops is what a paused player looks like from here), arms the origin to refuse every lease minted so far, and resumes past the window's frontier so the read cannot finish until the healing request has actually delivered.Trace from the run: one refused request against the dead lease, then one re-resolve, then served.
The grace tests are unchanged and still assert three attempts, since their gap is nowhere near the threshold.
1928 tests in 278 suitespass.Reported by @tschuegy in the 6.30.0 retest of #380, whose trace also answered the open question in that thread: the re-resolved target is the SAME edge host. What dies across an idle is not the address but the authorization behind it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01E5UztmCZtNYPQpzdmSdmWG