Repository navigation
cri: reset pull progress timer on idle→active transition - #13304
Merged
mxpv merged 1 commit intoJun 2, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a CRI image pull timeout flake by ensuring the pull progress reporter’s no-progress timer is reset when requests resume after an idle period, so newly-issued requests get a full timeout window to receive first bytes.
Changes:
- Update
pullProgressReporterto track the previous tick’sactiveReqsand resetlastSeenTimestampon an idle→active transition. - Add unit tests covering the basic cancel/no-cancel behavior of
pullProgressReporterfor stuck vs progressing requests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/cri/server/images/image_pull.go | Reset the pull no-progress timer on idle→active transitions by tracking prevActiveReqs. |
| internal/cri/server/images/image_pull_test.go | Add TestPullProgressReporter to validate cancellation for stuck requests and non-cancellation with byte progress. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dmcgowan
marked this pull request as draft
April 28, 2026 02:51
dmcgowan
force-pushed
the
cri-pull-progress-idle-active-reset
branch
from
April 28, 2026 03:25
0454ce2 to
4cda43d
Compare
The pull progress reporter resets lastSeenTimestamp on every tick where activeReqs == 0, but never on the transition to a non-zero count. When a pull is held in content.OpenWriter (idle in HTTP terms) and then unblocks, the next request can be cancelled less than `timeout` after it was actually issued — its first byte must arrive within whatever fraction of `timeout` remains on the timer captured during the previous idle tick. Track the previous tick's activeReqs and reset the timer on the 0→1 transition so a newly-issued request always gets a full timeout window to produce its first byte. This deflakes TestCRIImagePullTimeout/HoldingContentOpenWriterWithLocalPull, which hits ghcr.io directly and can exceed the shrunken window during auth handshakes in CI. Signed-off-by: Derek McGowan <[email protected]>
dmcgowan
force-pushed
the
cri-pull-progress-idle-active-reset
branch
from
April 29, 2026 00:25
4cda43d to
6c396d0
Compare
fuweid
reviewed
Apr 30, 2026
| Debugf("progress for image pull") | ||
|
|
||
| if activeReqs == 0 || bytesRead > lastSeenBytesRead { | ||
| // Reset the no-progress timer when idle, when bytes were |
mxpv
approved these changes
May 22, 2026
samuelkarp
approved these changes
Jun 2, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 2, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 2, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 2, 2026
This was referenced Sep 15, 2026
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.
Summary
TestCRIImagePullTimeout/HoldingContentOpenWriterWithLocalPull(example failure).lastSeenTimestampwhenever a tick observesactiveReqs == 0, but never on the transition from idle to active. As a result, a request issued just after an idle period can be cancelled less thantimeoutafter it was actually sent on the wire — its first byte has to arrive within whatever fraction oftimeoutwas left on the timer captured during the previous idle tick.activeReqsand reset the timer when we observe a 0→nonzero transition, so a newly-issued request always gets a fulltimeoutwindow to produce its first byte.In the failing CI run, the test held
content.OpenWriterfor the amd64 manifest, which keptactiveReqs == 0while the pull blocked on the writer. When the test released the writer and the pull issued the GET for the manifest, the auth handshake (401→ token endpoint → retry) at ghcr.io took longer than the shrunken window, and the reporter cancelled the pull withcontext canceled.Test plan
go test -count=20 -run TestPullProgressReporter ./internal/cri/server/images/...go build ./internal/cri/server/images/...go vet ./internal/cri/server/images/...TestCRIImagePullTimeout(especially theHoldingContentOpenWriter*subtests).