Skip to content
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

Ensure writing to the digester completes before the digest calculation. #25

Merged
merged 1 commit into from
Oct 14, 2019

Conversation

ktock
Copy link
Contributor

@ktock ktock commented Oct 13, 2019

Sometimes, stargzifying an image fails with DIGEST_INVALID.

There is a race condition on the digester.
The method layer.Compressed() calculates the digest(with Sum() method)
immediately after the PipeWriter is unblocked. But even if the PipeWriter is
unblocked, it isn't guaranteed that the TeeReader completes writing the data
to the digester.

This commit solves this issue by ensuring wrinting to the digester completes
before the digest calculation using MultiWriter instead of TeeReader.

Sometimes, stargzifying an image fails with DIGEST_INVALID.

There is a race condition on `digester`.
The method `layer.Compressed()` calculates the digest(with `Sum()` method)
immediately after the `PipeWriter` is unblocked. But even if the `PipeWriter` is
unblocked, it isn't guaranteed that the `TeeReader` completes writing the data
to the `digester`.

This commit solves this issue by ensuring wrinting to the `digester` completes
before the digest calculation using `MultiWriter` instead of `TeeReader`.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
@googlebot googlebot added the cla: yes Signed a CLA label Oct 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Signed a CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants