Skip to content

Gate blob reads on in-progress writes to prevent spurious NotFound#342

Open
sean- wants to merge 2 commits intothought-machine:masterfrom
sean-:elan-inflight-write-gate
Open

Gate blob reads on in-progress writes to prevent spurious NotFound#342
sean- wants to merge 2 commits intothought-machine:masterfrom
sean-:elan-inflight-write-gate

Conversation

@sean-
Copy link
Copy Markdown

@sean- sean- commented Apr 1, 2026

When concurrent targets upload and read the same blob simultaneously, the reader can get a NotFound error because the write hasn't landed yet. This was observed in CI where GetTree failed for a blob being uploaded via BatchUpdateBlobs at the exact same millisecond.

Add an inflightWrites tracker that gates read operations on any in-progress write for the same digest hash. Uses context.WithCancel so parent context cancellation propagates naturally. All write paths (writeAll for BatchUpdateBlobs, writeBlob for ByteStream.Write) register with the tracker, and all read paths (readAllBlobCompressed, readCompressed) wait for completion before proceeding.

Also bumps Go toolchain from 1.23.2 to 1.24.2.

sean- added 2 commits April 1, 2026 12:07
When concurrent targets upload and read the same blob simultaneously,
the reader can get a NotFound error because the write hasn't landed yet.
This was observed in CI where GetTree failed for a blob being uploaded
via BatchUpdateBlobs at the exact same millisecond.

Add an inflightWrites tracker that gates read operations on any
in-progress write for the same digest hash. Uses context.WithCancel
so parent context cancellation propagates naturally. All write paths
(writeAll for BatchUpdateBlobs, writeBlob for ByteStream.Write) register
with the tracker, and all read paths (readAllBlobCompressed,
readCompressed) wait for completion before proceeding.

Also bumps Go toolchain from 1.23.2 to 1.24.2.
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