-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Nix cached truncated files downloaded #4533
Comments
This sounds like a bug in the proxy server. There is not much we can do if it's serving corrupted files... |
On |
Fixed in curl side curl/curl@d1f4007 |
Hm, I think I'm experiencing this. I don't have a great internet connection at the moment, and I think the download was interrupted. Not using a proxy server, just nixpkgs.url = "nixpkgs/nixos-21.11" (my only input) Now if I try to run it again I get the same error above:
Using nix 2.4 |
This kept happening and I was unable to figure out which file was truncated. The error does not specify the location and I was unable to turn on more verbosity (tried I ended up having to reinstall Nix. This is very bad user experience. Please reopen this issue. |
I ran into this too (no proxy server involved) - I tried a In the end, I had to do |
using cachix. so half hour ago it worked on other machine. it is new cache and we have 1TB plan. |
|
@dzmitry-lahoda are you able to |
Nice idea, will try next time. I did gc of store. So cannot retest now. But I guess deleting specific package will work. |
Can confirm It happened to me on the initial fetch of |
@omnibs I had the same issue and found that running (in my case)
Then running nix-store --delete /nix/store/s1vb9z51ynxvi9c7q8398wsrv6yrj9vk-source Worked fine. But your post pointed me in the right direction. Thanks! |
Same here, provider is github:
My collegue and I just suddenly start getting these.
|
Shouldn't there be a nar hash verified before corrupted files make it as far downstream as being extracted? |
I got this reproduced. So actually it happens when download just stops (no only via nix, that is issue of GH for some items). But when it happens, I get this I do So I think it is nix issue because it must not store partially downloaded files in store. This violates integrity of it for static derivation with well know hashes it is seems no acceptable. I am on nix 2.17. When GH started to work Ok, I cleaned store, did CURL well. But nix still was stucking. Like if it caching bad internet connection. I restared nix daemon. Nix consistently stucks on
same value all the time but after minute I got it
fine. feels like some Nix prameters and usage of curl lead to issue, but nix should not cache bad files anyway. |
this is not the case. issue with nix handling downloads. |
I am running into the exact same issue
I see it when trying to run
I have an alias that runs |
I have the same problem in my CI: https://github.com/formancehq/stack/actions/runs/6077877454/job/16488949571 |
This is an issue with github that's happening since yesterday. |
Same for us |
I wonder when it will be over?;;; I've been overhauling the entire flake.nix config settings because it hasn't been updated for several days. I mainly removed all the repositories that took a long time during the nix flake update. Lol. |
Latest from https://status.github.com:
🤞 |
For the Mac Pro 2013 (which can only be installed up to Monterey), I wondered why I was getting that error. Once I removed commercial-emacs, the build started without any issues. It's uncertain whether the nix community will offer the option to select commercial-emacs, but in any case, others might find this information useful. Naturally, there were no issues on other MacBooks with the latest Ventura installed. It seems there might be an issue when using repository sources not managed by nixpkgs, considering both the Mac version and the fact that there was an error on nixos as well. |
If you used
|
This looks very similar to behaviour you see in cache-poisoning related issues. Regardless of how the file was originally downloaded / the upstream server behaved, the local Nix CLI / daemon should not cache invalid archives. In our particular case, we observed that Nix was caching these invalid archives for 1.5 days |
My understanding is part of the issue here is that |
Ran into this today, and indeed I would expect a truncated cached asset to be invalidated or not be stored in the cache at all until it's validated. |
Describe the bug
In cases of some network error or proxy server error, downloading is ended too early and gives a truncated file. But the truncated file is still cached by nix, leading to immediate
truncated gzip input
every next time without refetching.This issue happens because:
Content-Length
, which makescurl
not possible to validate the output length.curl
returns zero but gives truncated file.curl
returns zero, but before extracting. It results in cached truncated files.Steps To Reproduce
nix-build -A osu-lazer https://github.com/r-ryantm/nixpkgs/archive/cc77f910fc1a06b7cb7eb43639c5904540483c70.tar.gz
or with other github archive URL.nix
will fail withtruncated gzip input
truncated gzip input
again without network access.Expected behavior
Nix caches the downloaded file only if it can be unpacked successfully.
So it can re-download the file and re-build in the next time.
nix-env --version
outputnix-env (Nix) 2.4pre20201205_a5d85d0
The text was updated successfully, but these errors were encountered: