cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.67k stars 103 forks source link

Cache only non-empty archives #685

Closed fkorotkov closed 7 months ago

fkorotkov commented 7 months ago

Fixes #684. But I'm not sure how it got into this state in the first place. URLSession.shared.data should've throw.

ruimarinho commented 7 months ago

@fkorotkov I see what you mean but note that the remote archive was not empty in this case. What could prompt an empty extraction?

fkorotkov commented 7 months ago

This is still unclear. I just reproduced your situation by manually passing and empty Data down the code. It could've been empty if the request failed but then it should've throw an exception. Maybe your previous segmentation error left state of the cache corrupted.

In any case this change adds more safety checks into the logic.

ruimarinho commented 7 months ago

With 2.4.2, with a new URL to ensure cache is not used, I still get an empty extraction inside the VM:

 % tart run --dir=gh:https://github.com/actions/runner/archive/refs/tags/v2.311.0.zip sonoma-base
Using cached archive for https://github.com/actions/runner/archive/refs/tags/v2.311.0.zip...
Unarchived into a temporary directory!

Any idea on how to further debug this?

fkorotkov commented 7 months ago

Is it getting reproduced on one host? I wonder of local cache got corrupted. Could you please try to invalidate it:

rm -rf ~/Library/Caches/tart
ruimarinho commented 7 months ago

I can confirm this now -- the cache was corrupted on this host. Everything is working as expected now. Many thanks for your help @fkorotkov.