Repository navigation
fix(relay): a switch-file read cut off mid-body is asked for again - #27049
Conversation
The flag channel recorded a generation as seen before reading its body, so a read that failed mid-body sent ifGenerationNotMatch for it on every later poll and got 304 forever: that write was stranded until the object changed again. The generation now counts as seen only once its body has been read and parsed.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe channel now records a generation only after it completes a bounded response-body read and parses the JSON successfully. A test covers a truncated response, a retry without Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Switch-file reads that are cut off mid-body will now be retried on the next poll instead of being stuck on 304 responses. No actionable merge risk remains. Pre-merge checks |
|
ELI5
Each cell reads its switch file from Cloud Storage every 5 s. If one read was cut off halfway, the cell wrongly remembered that version as read and never asked for it again, so that switch change never took effect on that cell. Now it asks again.
What Changed
relay-control-flag-channel.tssetseenGenerationbefore reading the body. A read that failed mid-body (connection reset, timeout, past the 64 KiB bound) then made every later poll sendifGenerationNotMatch=<that generation>, which Cloud Storage answers with 304, so the write was stranded until the object changed again. The generation is now recorded only after the body has been read and parsed as JSON. A body that parses but is void (a bad known value) is still recorded, so it is not re-read every 5 s (unchanged).Why
From the second-roll audit. Every step-5 flip and every flip back goes through this channel, so a stranded read would break the ≤ 15 s revert. It must ride the one cell image.
Linked Issue
N/A (internal relay redesign, step 5).
Visual Proof
N/A: server-side, no UI.
Testing
ifGenerationNotMatchand applies it. The test fails without the fix.