Skip to content

vendor: update c/storage #2844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

giuseppe
Copy link
Member

follow-up for containers/storage#2312

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m afraid I’m behind on the c/storage PR, but, how does this work?

AFAICS this means that chunkedDiffer.tarSplit is closed by the time this function returns.

But, just below, PrepareStagedLayer ultimately calls chunkedDiffer.ApplyDiff, which copies differ.tarSplit to out.TarSplit. This function stores out to diffOutputs and returns, closing tarSplit.

Later, createNewLayer calls ApplyStagedLayer, and that, in applyDiffFromStagingDirectory, tries to read an already-closed file.

What am I missing?

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: this will be correct with containers/storage#2323 .

@giuseppe giuseppe force-pushed the update-c-storage-29-apr-2025 branch 2 times, most recently from ce9b3b2 to 0382a71 Compare May 8, 2025 06:21
@giuseppe
Copy link
Member Author

giuseppe commented May 8, 2025

rebased

@@ -421,7 +421,7 @@ func (s *storageImageDestination) PutBlobPartial(ctx context.Context, chunkAcces
}
}()

differ, err := chunked.GetDiffer(ctx, s.imageRef.transport.store, srcInfo.Digest, srcInfo.Size, srcInfo.Annotations, &fetcher)
differ, err := chunked.NewDiffer(ctx, s.imageRef.transport.store, srcInfo.Digest, srcInfo.Size, srcInfo.Annotations, &fetcher)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The part that ensured differ.Close was called (and that motivated breaking the API to s/Get/New/ here) got lost?!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I missed the error path on s.imageRef.transport.store.PrepareStagedLayer(), because later on CleanupStagedLayer takes care of it.

Do you prefer to have the differ.Close() just there or through a new defer function?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

containers/storage#2323 now documents on NewDiffer that

The caller must call Close() on the returned Differ.

so I’d prefer doing exactly that — defer seems easiest.

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Signed-off-by: Giuseppe Scrivano <[email protected]>
@giuseppe giuseppe force-pushed the update-c-storage-29-apr-2025 branch from 0382a71 to 3c26936 Compare May 9, 2025 13:13
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.

2 participants