unikraft / kraftkit

Build and use highly customized and ultra-lightweight unikernel VMs.
https://unikraft.org/docs/cli
BSD 3-Clause "New" or "Revised" License
226 stars 62 forks source link

Unexpected EOF #1479

Closed andrei5000 closed 5 months ago

andrei5000 commented 5 months ago

Describe the bug

When using kraftkit I sometimes get the " unpacking the image: writing file: unexpected EOF" error.

Steps to reproduce

To achieve this error I used the "kraft run" command in the "catalog/examples/http-python3.12-flask3.0" directory and let it begin pulling the image and interrupting it (CTRL + C) after letting it run for about half the time it takes to fully pull the image. This almost always left me with the above mentioned error, and upon running "kraft run" again each time it would almost immediately give this error again. Deleting the .tar archive from the ./local/share/kraftkit/runtime/oci/digest/sha256 fixed this bug, allowing me to run "kraft run" without issue again. Both the cancellation and deletion can be repeated to get this error again / make it go away.

I think this happens because either the incomplete tar file is not checked (or an attempt to read it is made), but I am not sure of this. Most times after getting this bug and making it disappear I get the "received event error: context canceled, E event: context canceled" errors, but am unsure if it is related.

I am using Native Ubuntu 22.04

Expected behavior

Not getting said error.

Which architectures were you using or does this bug affect?

No response

Which operating system were you using or does this bug affect?

No response

Relevant log output

No response

craciunoiuc commented 5 months ago

So this happens because the pull was not complete, so the written file is not complete

Then when you retry it will use that file cause it finds it, but it's incomplete so it fails (unexpected End Of File)

Fix for this should be to catch Ctrl^C and clean up if download is not complete