What happened:
In our build system we pull+cache images using crane in an OCI layout format. We then attempt to SBOM these images which may share layer tarballs.
Concurrently running Image.Read results in the following error being returned:
l.indexedContent, err = file.NewTarIndex(
tarFilePath,
layerTarIndexer(tree, l.fileCatalog, &l.Metadata.Size, l, monitor),
)
if err != nil {
return fmt.Errorf("failed to read layer=%q tar : %w", l.Metadata.Digest, err)
}
failed to read
layer="sha256:994393dc58e7931862558d06e46aa2bb17487044f670f310dffe1d24e4d1eec7" tar : unexpected EOF
I believe this is caused by stereoscope re-using file handles in os.Open resulting in a race condition of reads.
What you expected to happen:
Image SBOMing is go-routine safe w/ images that share layers.
How to reproduce it (as minimally and precisely as possible):
In a system w/ low IO speed (Github's default runner works):
- Pull multiple images that share layers across them and store as OCI layout (images w/
alpine base work)
- Attempt to go-routine image SBOMing
Anything else we need to know?:
Full stereoscope + syft logs in our CI run: https://github.com/defenseunicorns/zarf/actions/runs/5485435230/jobs/9994240328?pr=1887
Environment:
- Github default runner
ubuntu-latest
What happened:
In our build system we pull+cache images using crane in an OCI layout format. We then attempt to SBOM these images which may share layer tarballs.
Concurrently running
Image.Readresults in the following error being returned:I believe this is caused by stereoscope re-using file handles in
os.Openresulting in a race condition of reads.What you expected to happen:
Image SBOMing is go-routine safe w/ images that share layers.
How to reproduce it (as minimally and precisely as possible):
In a system w/ low IO speed (Github's default runner works):
alpinebase work)Anything else we need to know?:
Full stereoscope + syft logs in our CI run: https://github.com/defenseunicorns/zarf/actions/runs/5485435230/jobs/9994240328?pr=1887
Environment:
ubuntu-latest