You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We still see ERROR Switching: Pulling: Importing: Parsing layer blob sha256:43373869bc293673e2dfc59a04c626501893eed1f7c1ec98004f2e7c0e41a245: failed to invoke method FinishPipe: failed to invoke method FinishPipe: write |1: broken pipe occasionally at least in CI runs though I haven't seen it myself personally/interactively.
I've been running the previous reproducer in a loop for a while on the latest code, and for better or worse I don't see any broken pipes. So at the very least I don't think we've regressed on that particular fix.
Next I'll look at the zstd:chunked case and see how that plays into things.
Aside, I wasted entirely too much time this morning trying to debug podman before I realized I was hitting podman-container-tools/container-libs#122. I had to remove podman-machine from the loop entirely and do the compression directly on my host with 64GB in order for it to actually push 😭
Debug output from skopeo, once I realized I had to rebuild ostree_ext pointing at git head for containers-image-proxy because we never released a new version that contains bootc-dev/containers-image-proxy-rs#70 (TODO!)
# ostree --repo=repo refs --delete ostree/container; CONTAINERS_IMAGE_PROXY_DEBUG=1 ./bootc internals ostree-container image pull --quiet --insecure-skip-tls-verification repo ostree-unverified-registry:localhost:5000/zstdchunked
DEBU[0000] Executing method Initialize
DEBU[0000] Using SQLite blob info cache at /var/lib/containers/cache/blob-info-cache-v1.sqlite
DEBU[0000] Sending reply: err=<nil> value=0.2.6 pipeid=0
DEBU[0000] Executing method OpenImage
DEBU[0000] Using registries.d directory /etc/containers/registries.d
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf"
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf.d/000-shortnames.conf"
DEBU[0000] Trying to access "localhost:5000/zstdchunked:latest"
DEBU[0000] Returning credentials for localhost:5000/zstdchunked from DockerAuthConfig
DEBU[0000] No signature storage configuration found for localhost:5000/zstdchunked:latest, using built-in default file:///var/lib/containers/sigstore
DEBU[0000] Looking for TLS certificates and private keys in /etc/docker/certs.d/localhost:5000
DEBU[0000] GET https://localhost:5000/v2/
DEBU[0000] Ping https://localhost:5000/v2/ err Get "https://localhost:5000/v2/": http: server gave HTTP response to HTTPS client (&url.Error{Op:"Get", URL:"https://localhost:5000/v2/", Err:(*errors.errorString)(0x55fb097c1890)})
DEBU[0000] GET http://localhost:5000/v2/
DEBU[0000] Ping http://localhost:5000/v2/ status 200
DEBU[0000] GET http://localhost:5000/v2/zstdchunked/manifests/latest
DEBU[0000] Content-Type from manifest GET is "application/vnd.oci.image.manifest.v1+json"
DEBU[0000] IsRunningImageAllowed for image docker:localhost:5000/zstdchunked:latest
DEBU[0000] Using default policy section
DEBU[0000] Requirement 0: allowed
DEBU[0000] Overall: allowed
DEBU[0000] Sending reply: err=<nil> value=1 pipeid=0
DEBU[0000] Executing method GetManifest
DEBU[0000] Sending reply: err=<nil> value=sha256:7f82360ee7198cad6685c7429672d21540c268c54baf0d6a5e3a04743bdb1e9c pipeid=7
DEBU[0000] Executing method FinishPipe
DEBU[0000] Completed pipe goroutine
DEBU[0000] Sending reply: err=<nil> value=<nil> pipeid=0
DEBU[0000] Executing method GetFullConfig
DEBU[0000] Downloading /v2/zstdchunked/blobs/sha256:9f3411e5c4ba5e876f6ca8b3db96f536973b410a6a425ec30b9bd7445d984008
DEBU[0000] GET http://localhost:5000/v2/zstdchunked/blobs/sha256:9f3411e5c4ba5e876f6ca8b3db96f536973b410a6a425ec30b9bd7445d984008
DEBU[0000] Sending reply: err=<nil> value=<nil> pipeid=7
DEBU[0000] Executing method FinishPipe
DEBU[0000] Completed pipe goroutine
DEBU[0000] Sending reply: err=<nil> value=<nil> pipeid=0
layers already present: 0; layers needed: 1 (60.9 MB)
DEBU[0000] Executing method GetLayerInfo
DEBU[0000] Sending reply: err=<nil> value=[{sha256:f5d3e8e90d538ff16bd4d8719929cbeebee96473d79529975ef602c472256960 60947386 application/vnd.oci.image.layer.v1.tar+zstd}] pipeid=0
DEBU[0000] Executing method GetBlob
DEBU[0000] Downloading /v2/zstdchunked/blobs/sha256:f5d3e8e90d538ff16bd4d8719929cbeebee96473d79529975ef602c472256960
DEBU[0000] GET http://localhost:5000/v2/zstdchunked/blobs/sha256:f5d3e8e90d538ff16bd4d8719929cbeebee96473d79529975ef602c472256960
DEBU[0000] Sending reply: err=<nil> value=60947386 pipeid=7
DEBU[0000] Executing method FinishPipe
DEBU[0000] Completed pipe goroutine
DEBU[0000] Sending reply: err=write |1: broken pipe value=<nil> pipeid=0
ERROR Importing: Parsing layer blob sha256:f5d3e8e90d538ff16bd4d8719929cbeebee96473d79529975ef602c472256960: failed to invoke method FinishPipe: failed to invoke method FinishPipe: write |1: broken pipe
I'd probably add env RUST_LOG=debug here too (or maybe scoped to just the ostree-ext stack)
Here's the relevant bit which includes some thus-far unsuccessful attempts to fix this. Most notably I tried reapplying this patch because this feels like it's at least in the ballpark of the problem.
Right, seeing EPIPE on both sides which definitely implies we need to hold open one side of the pipe longer. It's really interesting though that zstd:chunked would somehow always trigger this.
Specifically, we have blob which ultimately contains the read side of the pipe. That gets moved into write_tar and then into filter_tar_async, and then we drop it explicitly here:
Worth noting that it's not all zstd:chunked images that are broken. I've created a FROM scratch container with just a /empty.txt file, and that pulls successfully.
Also another tidbit, I tried inserting a tokio::time::sleep(Duration::from_millis(1000)).await; immediately before we drop(src) in filter_tar_async, and that also doesn't help.
When it fails, it fails like:
DEBU[0000] Executing method FinishPipe
TRACE write_tar: Sleeping before dropping src
TRACE write_tar: After dropping src
DEBU[0001] Completed pipe goroutine
DEBU[0001] Sending reply: err=write |1: broken pipe value=<nil> pipeid=0
TRACE write_tar: tar written successfully
or
DEBU[0000] Executing method FinishPipe
TRACE write_tar: Sleeping before dropping src
DEBU[0001] Completed pipe goroutine
TRACE write_tar: After dropping src
DEBU[0001] Sending reply: err=write |1: broken pipe value=<nil> pipeid=0
TRACE write_tar: tar written successfully
When it works:
DEBU[0000] Executing method FinishPipe
DEBU[0000] Completed pipe goroutine
TRACE write_tar: Sleeping before dropping src
DEBU[0000] Sending reply: err=<nil> value=<nil> pipeid=0
TRACE finish_pipe:impl_request: completed request self=ImageProxy pipeid=8 self=ImageProxy method="FinishPipe"
TRACE write_tar: After dropping src
TRACE write_tar: tar written successfully
or
DEBU[0000] Executing method FinishPipe
TRACE write_tar: Sleeping before dropping src
DEBU[0000] Completed pipe goroutine
DEBU[0000] Sending reply: err=<nil> value=<nil> pipeid=0
TRACE finish_pipe:impl_request: completed request self=ImageProxy pipeid=8 self=ImageProxy method="FinishPipe"
TRACE write_tar: After dropping src
TRACE write_tar: tar written successfully
I don't think that really helps clarify anything though.
I have a hunch, based on the following observations:
On the client side, we consume the entire tar stream and shove it into ostree successfully
On the proxy side, we're still blocked trying to write the entire blob over the pipe
Based on that, what I think is happening is that there's extra zstd metadata/skippable frames/etc at the very end of the stream. Then we get into a situation where there's some racing depending on order of futures or buffering or timing of how much we read out of the pipe. Sometimes, the zstd decompressor is able to slurp up the entire stream. Sometimes, we finish the blob future while there's still trailing data in the pipe, and this causes everything to break (or hang, if you don't drop the read end of the pipe prematurely).
Activity
jeckersb commentedon Mar 17, 2025
I've been running the previous reproducer in a loop for a while on the latest code, and for better or worse I don't see any broken pipes. So at the very least I don't think we've regressed on that particular fix.
Next I'll look at the zstd:chunked case and see how that plays into things.
jeckersb commentedon Mar 18, 2025
Ok verified that ztd:chunked is consistently broken:
Aside, I wasted entirely too much time this morning trying to debug podman before I realized I was hitting podman-container-tools/container-libs#122. I had to remove podman-machine from the loop entirely and do the compression directly on my host with 64GB in order for it to actually push 😭
jeckersb commentedon Mar 18, 2025
Debug output from
skopeo, once I realized I had to rebuildostree_extpointing at git head forcontainers-image-proxybecause we never released a new version that contains bootc-dev/containers-image-proxy-rs#70 (TODO!)cgwalters commentedon Mar 18, 2025
I'd probably add
env RUST_LOG=debughere too (or maybe scoped to just the ostree-ext stack)jeckersb commentedon Mar 18, 2025
Here's the relevant bit which includes some thus-far unsuccessful attempts to fix this. Most notably I tried reapplying this patch because this feels like it's at least in the ballpark of the problem.
I'm thinking we might need to revisit ostreedev/ostree-rs-ext#672
cgwalters commentedon Mar 19, 2025
Right, seeing EPIPE on both sides which definitely implies we need to hold open one side of the pipe longer. It's really interesting though that zstd:chunked would somehow always trigger this.
jeckersb commentedon Mar 19, 2025
So the problem seems to be in here:
bootc/ostree-ext/src/container/store.rs
Lines 930 to 957 in 244c1a0
Specifically, we have
blobwhich ultimately contains the read side of the pipe. That gets moved intowrite_tarand then intofilter_tar_async, and then we drop it explicitly here:bootc/ostree-ext/src/tar/write.rs
Line 382 in 244c1a0
The problem is that can get dropped before the
join_fetchinimportcompletes, which will close the read end out from the driver.jeckersb commentedon Mar 20, 2025
Worth noting that it's not all zstd:chunked images that are broken. I've created a
FROM scratchcontainer with just a/empty.txtfile, and that pulls successfully.Compare working from the
emptyimage:To the failing image (local copy of
quay.io/fedora/fedora:41converted to zstd:chunked):jeckersb commentedon Mar 20, 2025
I generated two more
FROM scratchcontainers, populating with random data. One is 50MB, the other is 200MB.The 50MB one pulls successfully.
The 200MB one fails.
🫠
cgwalters commentedon Mar 20, 2025
oci:ordir:jeckersb commentedon Mar 21, 2025
Nope, doesn't seem to change anything.
We did this together live yesterday, but for the permanent record, no it doesn't reproduce with just containers-image-proxy.
jeckersb commentedon Mar 21, 2025
Also another tidbit, I tried inserting a
tokio::time::sleep(Duration::from_millis(1000)).await;immediately before wedrop(src)infilter_tar_async, and that also doesn't help.When it fails, it fails like:
or
When it works:
or
I don't think that really helps clarify anything though.
jeckersb commentedon Mar 25, 2025
I have a hunch, based on the following observations:
Based on that, what I think is happening is that there's extra zstd metadata/skippable frames/etc at the very end of the stream. Then we get into a situation where there's some racing depending on order of futures or buffering or timing of how much we read out of the pipe. Sometimes, the zstd decompressor is able to slurp up the entire stream. Sometimes, we finish the blob future while there's still trailing data in the pipe, and this causes everything to break (or hang, if you don't drop the read end of the pipe prematurely).
jeckersb commentedon Mar 25, 2025
That's 100% the problem, everything works after fixing that. I'll do some cleanup and post the PR shortly.
ostree-ext/filter_tar_async: flush decompressor stream
ostree-ext/filter_tar_async: flush decompressor stream