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

error: unexpected end-of-file when cache is not found on https://cache.nixos.org #4903

Open
happysalada opened this issue Jun 10, 2021 · 13 comments
Labels
bug ca-derivations Derivations with content addressed outputs stale

Comments

@happysalada
Copy link
Contributor

happysalada commented Jun 10, 2021

Describe the bug

When running a nix command sometimes, nix tries to fetch a cache, when the url is 404, the error generated is just
error: unexpected end-of-file

Steps To Reproduce

running

> nix develop -vvv
querying info about '/nix/store/4yy83b75l7v3bcww26l1b05vp54y50k4-nix-shell-env' on 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/4yy83b75l7v3bcww26l1b05vp54y50k4.narinfo'...
error: unexpected end-of-file

When I try to curl the url, it gives me a 404

I don't know why nix is looking at that path specifically, but I get that error quite often recently.

Here is my flake.lock

{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1623154001,
        "narHash": "sha256-KxsIXg5ez5SveGayOKcW+MnofqVuLnwZHE5mZgtRAJo=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "3bc8e5cd23b84b2e149e7aaad57117da16a19e6f",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "nixpkgs-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

here is the

❯ nix --version
nix (Nix) 2.4pre20210601_5985b8b

Expected behavior

Is there a way when the cache returns a 404 to try to build the derivation?

I'm not sure what additional information might be needed.

nix-env --version output

❯ nix-env --version
nix-env (Nix) 2.4pre20210601_5985b8b

Additional context

I have those experimental-features enabled

      experimental-features = nix-command flakes ca-derivations ca-references
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/content-addressed-nix-call-for-testers/12881/102

@thufschmitt thufschmitt added the ca-derivations Derivations with content addressed outputs label Jun 12, 2021
@thufschmitt
Copy link
Member

Thanks for reporting. Do you have the full Nix code available so that I can try to reproduce it?

Also, is the Nix daemon using the same Nix version as the client?

(Btw, nix develop is currently broken with CA derivations)

@happysalada
Copy link
Contributor Author

nix daemon is using the same version yes

❯ nix-daemon --version
nix-daemon (Nix) 2.4pre20210601_5985b8b

Understood that nix-develop is broken with CA derivations.

Unfortunately, I can't reproduce systematically the error. Sometimes it happens with a particular code, and then it doesn't happen anymore.

It happens to be sometimes with my dotfiles
github.com/happysalada/dotfiles
running something like nix build .\#darwinConfigurations.raphael.system but it's not consistent.
(my next move is to disable the ca-* and see if the error persists, to see if it is related).
When there is a problem, I try to forcefully repeat the command many times and it succeeds at some point.
I thought that it was because of the gc running or something, but I've deactivated automatic gc.
I will try another -vvv to see if I can get more information.
I was thinking of looking for what happens when the cache.nixos.org returns a 404, how it is handled.

@bbigras
Copy link

bbigras commented Jun 23, 2021

I don't know if it could help reproduce it, but on my system I just need to run this:

❯ nix-env --quiet -j8 -iA cachix -f https://cachix.org/api/v1/install
error: unexpected end-of-file

@happysalada
Copy link
Contributor Author

If you want to check if it is the same error, you can run your command again with the flag -vvv it should give you more information. If there is a 404 in there when requesting a cache, it could be the same!

@bbigras
Copy link

bbigras commented Jun 25, 2021

❯ nix-env -vvv --quiet -j8 -iA cachix -f https://cachix.org/api/v1/install
downloading 'https://cachix.org/api/v1/install'...
evaluating file '/nix/store/j24029fbiy3nlrcssbq7rdl8ljjym54f-source'
evaluating file '/nix/store/7l15l15d9wmh0fwpr943xqll9bpvq3pi-env-manifest.nix'
installing 'cachix-0.6.1'
error: unexpected end-of-file

@happysalada
Copy link
Contributor Author

Thank you for the added info!

I have to say it doesn't look like the same error.
From what I gathered from other people, that unexpected end-of-file error could also be due to a problem between the nix-env and the nix-daemon version being different. If that is not the case for you as well, then it may be something else.

@domenkozar
Copy link
Member

It can be that nix-daemon crashes, do look at the logs.

@bbigras
Copy link

bbigras commented Jun 29, 2021

jun 29 16:48:42 desktop nix-daemon[307391]: nix-daemon: src/libstore/derivations.cc:630: static std::string_view nix::BasicDerivation::nameFromPath(const nix::StorePath&): Assertion `hasSuffix(nameWithSuffix, extension)' failed.
jun 29 16:48:44 desktop systemd-coredump[307398]: [🡕] Process 307391 (nix-daemon) of user 0 dumped core.

@bbigras
Copy link

bbigras commented Jul 1, 2021

Should I open a new issue for the crash? In this repo?

@domenkozar
Copy link
Member

@bbigras please :)

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/remote-building-experienence-massively-degraded-since-2-3-months/16950/1

@stale
Copy link

stale bot commented Jul 10, 2022

I marked this as stale due to inactivity. → More info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ca-derivations Derivations with content addressed outputs stale
Projects
None yet
Development

No branches or pull requests

5 participants