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

image-rs | failed to handle image layers that has long name hard link file inside #689

Closed
Xynnn007 opened this issue Aug 21, 2024 · 8 comments · Fixed by #715
Closed

image-rs | failed to handle image layers that has long name hard link file inside #689

Xynnn007 opened this issue Aug 21, 2024 · 8 comments · Fixed by #715
Labels

Comments

@Xynnn007
Copy link
Member

Xynnn007 commented Aug 21, 2024

Thanks to @bpradipt , we found that image-rs currently cannot pull image layers that have long name hard link file (more than 100 chars) layer. Errors like the following

running 1 test
test pull::tests::test_async_pull_client has been running for over 60 seconds
test pull::tests::test_async_pull_client ... FAILED

failures:

---- pull::tests::test_async_pull_client stdout ----
Got error on function call attempt 0. Will retry in 1s: failed to handle layer: hasher sha256: failed to unpack `/tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.pyc`

Caused by:
    No such file or directory (os error 2) while canonicalizing /tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.opt-1
Got error on function call attempt 1. Will retry in 1s: failed to handle layer: hasher sha256: failed to unpack `/tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.pyc`

Caused by:
    No such file or directory (os error 2) while canonicalizing /tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.opt-1
Got error on function call attempt 2. Will retry in 1s: failed to handle layer: hasher sha256: failed to unpack `/tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.pyc`

Caused by:
    No such file or directory (os error 2) while canonicalizing /tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.opt-1
Got error on function call attempt 3. Will retry in 1s: failed to handle layer: hasher sha256: failed to unpack `/tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.pyc`

Caused by:
    No such file or directory (os error 2) while canonicalizing /tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.opt-1
Got error on function call attempt 4. Will retry in 1s: failed to handle layer: hasher sha256: failed to unpack `/tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.pyc`

Caused by:
    No such file or directory (os error 2) while canonicalizing /tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.opt-1
thread 'pull::tests::test_async_pull_client' panicked at image-rs/src/pull.rs:279:13:
Function did not return Ok after retries: last_err Some(failed to handle layer: hasher sha256: failed to unpack `/tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.pyc`

Caused by:
    No such file or directory (os error 2) while canonicalizing /tmp/.tmpZkP1l0/sha256_0f3abe6724adb8f4c40655dc274e98dad2dadb3f5ea88efe3c7d76a1983ca3b5/usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/generate_completion_cache.cpython-312.opt-1)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    pull::tests::test_async_pull_client

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 49 filtered out; finished in 72.48s

Two typical images triggering this

This is not supported by underlying krata-tokio-tar crate. Related issue in tar (tokio-tar is based on that) is alexcrichton/tar-rs#369

@Xynnn007
Copy link
Member Author

cc @arronwy

@bpradipt
Copy link
Member

The issue doesn't occur if switching back to older implementation of using sync tar, ie before commit 921006fe7e04241057685bba16770320f5388d81

@Xynnn007
Copy link
Member Author

The issue doesn't occur if switching back to older implementation of using sync tar, ie before commit 921006fe7e04241057685bba16770320f5388d81

Good. It means that the sync tar had implemented this, thus we could have a good teacher to learn from to promote async-tar.

bpradipt added a commit to bpradipt/kata-containers that referenced this issue Aug 22, 2024
Commit 921006fe7e04241057685bba16770320f5388d81 introduced
async tar for performance optimisation. However the unintended consequence
of it is layers with long pathnames (100 chars) failed to unpack

Ref: confidential-containers/guest-components#689

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
@Xynnn007
Copy link
Member Author

I put the fix PR on original krata-tokio-tar edera-dev/tokio-tar#2. Let see if any progress.

@JakubLedworowski
Copy link

Hi @Xynnn007, looks like for the last weeks the PR you created has not yet been merged. I bumped it mentioning the repository owner. In the meantime, have you possibly found a way to workaround this?

@Xynnn007
Copy link
Member Author

Xynnn007 commented Sep 9, 2024

@JakubLedworowski Thanks for raising that up in the thread. Up to now I have only two ways except waiting for upstream

  1. create a fork code
  2. try to use shorter names for images

Both might be difficult. Do you have any ideas? @bpradipt

@bpradipt
Copy link
Member

bpradipt commented Sep 9, 2024

@Xynnn007 let's wait till this week to see if there is any update to the PR. Otherwise we can plan to fork the code and keep it under coco org. Option-2 is not practical imho

@azenla
Copy link

azenla commented Sep 10, 2024

Apologies for jumping in on this issue but wanted to communicate somewhere with folks :)

First, I didn't know our fork was being used for Confidential Containers but that's super cool given that we are have similar goals at Edera (we aren't aiming to be confidential only, our platform provides isolation in general, with confidentiality being a feature add)! I just published release v0.4.1 of krata-tokio-tar with the necessary change, and v0.4.2 which swaps to portable-atomic for atomics, broadening platform support for krata-tokio-tar.

Now that I am aware of it's use, I'd be happy to make our fork a collaborative effort. Please feel free to contact me at alex AT edera.dev if there are any questions!

Xynnn007 added a commit to Xynnn007/guest-components that referenced this issue Sep 11, 2024
The new version of krata-tokio-tar supports long link name.

Fixes confidential-containers#689

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants