Skip to content

content: drain stream on proxy writer close to fix ingest race - #13046

Draft
dmcgowan wants to merge 1 commit into
containerd:mainfrom
dmcgowan:fix-content-close-race
Draft

dmcgowan wants to merge 1 commit into
containerd:mainfrom
dmcgowan:fix-content-close-race

Conversation

@dmcgowan

Copy link
Copy Markdown
Member

(Attempt at fixing one of the flaky tests, will mark as draft and see if its hit, for example)

=== Failed
=== FAIL: integration/client TestContentClient/CommitErrorState (0.20s)
    testsuite.go:122: Cleanup failed: failed to abort c1-commiterror-state: unlinkat /var/lib/containerd-test/io.containerd.content.v1.content/ingest/9101c5f249b4cb38a50dddda86a787c09f31099573c87c525fc50774ac21d05d: directory not empty
    --- FAIL: TestContentClient/CommitErrorState (0.20s)

=== FAIL: integration/client TestContentClient (5.94s)

Fix a race between the proxy writer's Close and a subsequent Abort on the same ingest ref. CloseSend() returns immediately without waiting for the server-side stream handler to complete its deferred cleanup. The server's deferred writer Close writes an updatedat file to the ingest directory, which can race with Abort's os.RemoveAll on the same directory, causing:

unlinkat .../: directory not empty

Drain the stream after CloseSend to ensure the server handler fully completes before the client proceeds.

Fix a race between the proxy writer's Close and a subsequent Abort on
the same ingest ref. CloseSend() returns immediately without waiting
for the server-side stream handler to complete its deferred cleanup.
The server's deferred writer Close writes an updatedat file to the
ingest directory, which can race with Abort's os.RemoveAll on the
same directory, causing:

  unlinkat .../<ingest-dir>: directory not empty

Drain the stream after CloseSend to ensure the server handler fully
completes before the client proceeds.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: Derek McGowan <[email protected]>
@github-actions

Copy link
Copy Markdown

This PR has not been updated in 6 months and is now marked as stale. It will be closed in 2 weeks unless there is new activity, a milestone is assigned, or a maintainer adds a priority or status label.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants