Skip to content

cache.nixos.org sometimes unreachable #14874

Closed

Description

@yorickvP

Issue description

When I try to install or build anything, it usually downloads a lot of packages, but some others time out on cache.nixos.org (only some of the mirrors seem to be down, so it's always different packages), and I have to retry the build a few times before it succeeds.

Steps to reproduce

Do anything that requires package downloads.

Technical details

  • System: NixOS 16.09pre79453.32b7b00
  • Nix version: 1.11.2

Activity

  1. edolstra commented on Apr 21, 2016

    @edolstra
    Member

    Sorry, but there is not much info here that would allow us to reproduce the problem. The report doesn't even include an error message...

  2. yorickvP commented on Apr 21, 2016

    @yorickvP
    ContributorAuthor

    Okay, I gathered some more info:
    cache.nixos.org resolves to (among others) server-54-240-184-235.ams50.r.cloudfront.net

    Now, try
    curl -H 'Host: cache.nixos.org' http://54.240.184.235/nix-cache-info
    a whole bunch of times in rapid succession, until an invocation takes multiple minutes to complete. (querying this server this rapidly is what nix does too, and it does eventually have downloads that take multiple minutes to complete).

    I suspect cloudfront is doing throttling or firewalling.

  3. obadz commented on Apr 22, 2016

    @obadz
    Contributor

    Thought I'd add my 2 cents on cache download issue.

    I've seen two types of network errors. One that leads to a hang when initiating many downloads with download-from-binary-cache.pl: I will paste the error message next time I get it.

    The other leads to this error:

    *** Downloading ‘http://cache.nixos.org/nar/0jlld4di2l1yygx6qnchv5kpvgar91lzqaiih57wh6n0vfwx7lc0.nar.xz’ (signed by ‘cache.nixos.org-1’) to ‘/nix/store/sl866aqxc10aa63pb1clvgxsrv8dywnw-hook’...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0   250    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100   229  100   229    0     0   1523      0 --:--:-- --:--:-- --:--:--  1523
    /nix/store/skdijd3r067cbhh5dn6ya83cz33and2w-xz-5.2.2-bin/bin/xz: (stdin): File format not recognized
    error: unexpected end-of-file
    download of ‘http://cache.nixos.org/nar/0jlld4di2l1yygx6qnchv5kpvgar91lzqaiih57wh6n0vfwx7lc0.nar.xz’ failed: No such file or directory
    

    Both are fixed by waiting and retrying.

    They occur often enough that I get them about 3 times each on a nixos-rebuild that downloads the full OS.

    Also see #9081

  4. obadz commented on Apr 25, 2016

    @obadz
    Contributor

    Hang that I often get doing be nixos-rebuild build:

    $ nixos-rebuild build
    building Nix...
    building the system configuration...
    download-from-binary-cache.pl: still waiting for ‘http://cache.nixos.org/ayihwm5jssbcawzwnll0p60p2xb46bzg.narinfo’ after 5 seconds...
    download-from-binary-cache.pl: still waiting for ‘http://cache.nixos.org/bkk6372sxn426b8lmjd46c8ji584j80i.narinfo’ after 5 seconds...
    download-from-binary-cache.pl: still waiting for ‘http://cache.nixos.org/8wc89sw7rb3fx5jvns4fhbpkyg4yq0a3.narinfo’ after 5 seconds...
    download-from-binary-cache.pl: still waiting for ‘http://cache.nixos.org/0zh45az50cqdlmk5npzrb25gnvq1di10.narinfo’ after 5 seconds...
    download-from-binary-cache.pl: still waiting for ‘http://cache.nixos.org/algs2c6nvrbsc4zsyd17q28sw0kvq537.narinfo’ after 5 seconds...
    download-from-binary-cache.pl: still waiting for ‘http://cache.nixos.org/bkb66y2qmvc3f9v03hi643inbh8cx6ga.narinfo’ after 5 seconds...
    download-from-binary-cache.pl: still waiting for ‘http://cache.nixos.org/adc8zvk7cxw53l2nvp99dv1x35093yw2.narinfo’ after 5 seconds...
    [… many more times…]
    

    Sometimes it gets unstuck on its own, sometimes it doesn't.

  5. boobiesinc commented on May 17, 2016

    @boobiesinc

    This happens at the beginning with nixos-install but is ignored, I wonder if I'm missing something though:

    download-from-binary-cache.pl: could not download  `httos://cache.nixos.org/nix-cache-info` (Curl error 77)
    

    Which apparently means:

    CURLE_SSL_CACERT_BADFILE (77)
    Problem with reading the SSL CA cert (path? access rights?)

    virtualbox_nixos2_17_05_2016_06_10_40

  6. boobiesinc commented on May 21, 2016

    @boobiesinc

    EDIT: looks like it's this: https://github.com/NixOS/nix/blob/4f3cf06c97cb1f15c74b51b60673a0ed9af0a603/scripts/download-from-binary-cache.pl.in#L461-L469
    EDIT: looks like activeRequests shouldn't go past maxParallelRequests which is binary-caches-parallel-connections = 3 in my case, BUT since nixPath setting in my configuration.nix IS IGNORED which is why I have to pass it as an env. NIX_PATH, then I can safely deduce that this is also ignored and thus fallback to maxParallelRequests being 25 ... I guess I should add --option instead! So the bigger issue then is, why are some settings in /mnt/etc/nixos/configuration.nix ignored!

    Why does it do that ?
    It seems like it's trying to download EVERYTHING at once, instead of only 3 at a time, serially.
    virtualbox_nixos_test1_21_05_2016_15_11_56

    virtualbox_nixos_test1_21_05_2016_15_11_44

    I have set

    nix.extraOptions = ''
     binary-caches-parallel-connections = 3
     connect-timeout = 5
    '';

    EDIT: sheet:
    sheetvirtualbox_nixos_test1_21_05_2016_15_39_43

  7. obadz commented on May 21, 2016

    @obadz
    Contributor

    nix-enving my user environment (which contains ~ 7GB) often crashes 5-10 times due to network issues.

    I now run it in a shell loop:

    $ (echo -n "started: "; date -R) >> nix-env.log; for i in `seq 1 20`; do nix-env -ikA nixpkgs.mainEnv && break; (echo -n "crashed $i: "; date -R) >> nix-env.log; echo RESTARTING $i IN 5s..; sleep 5; done; (echo -n "finished: "; date -R) >> nix-env.log
    
    $ cat nix-env.log
    started: Sat, 21 May 2016 14:17:46 +0100
    crashed 1: Sat, 21 May 2016 14:18:23 +0100
    crashed 2: Sat, 21 May 2016 14:21:37 +0100
    crashed 3: Sat, 21 May 2016 14:22:56 +0100
    crashed 4: Sat, 21 May 2016 14:24:30 +0100
    crashed 5: Sat, 21 May 2016 14:32:36 +0100
    crashed 6: Sat, 21 May 2016 14:39:48 +0100
    finished: Sat, 21 May 2016 14:44:29 +0100
  8. vcunat commented on May 22, 2016

    @vcunat
    Member

    why are some settings in /mnt/etc/nixos/configuration.nix ignored!

    @boobiesinc: I believe nixos-install runs with configuration specified for the system it runs on, not the one you're trying to install.

  9. yorickvP commented on Sep 20, 2016

    @yorickvP
    ContributorAuthor

    I'm not getting this problem anymore. @obadz, you? Otherwise, we can close this.

  10. obadz commented on Sep 20, 2016

    @obadz
    Contributor

    As of last week I was still getting the error.

  11. dtzWill commented on Oct 12, 2016

    @dtzWill
    Member

    Thanks for the tip for connect-timeout, I'm encountering this issue when attempting to rebuild many things at once... (things that aren't in the caches) and that options helps put an upper-bound on how long things wait. Playing with parallel connections (1,25,150) didn't seem to help but it did change how many times I saw the warning messages :).

  12. cessationoftime commented on Oct 22, 2016

    @cessationoftime
    Contributor

    I was unable to use the command: nixos-rebuild build -I nixpkgs=/home/cvanvranken/nixpkgs

    until I added to nix.extraOptions in my /etc/nixos/configuration.nix

    nix.extraOptions = ''
     binary-caches-parallel-connections = 3
     connect-timeout = 5
    '';
    

    This also prevented me from doing a fresh installation of nixos 16.09. Had to copy my vm from an existing installation and edit.

  13. 14 remaining items

  14. despairblue commented on Mar 3, 2017

    @despairblue
    Contributor

    I'm actually getting a lot of 404s, also for libssh2. Is this related to the S3 outage? Mabye builds during that period couldn't be uploaded to S3 but somehow their metadata (link to it) was still saved in the cache db? (not really sure how it works though)

  15. domenkozar commented on Mar 3, 2017

    @domenkozar
    Member

    @desiderius what channel are you on? What's the version of the channel? How are you installing ed?

  16. despairblue commented on Mar 3, 2017

    @despairblue
    Contributor

    @domenkozar I was on the newest nixos-unstable branch from nixpkgs-channels (when I'm home I can check for the specific commit), but I think it's that one, since it was the most current this morning (5 hours ago).

    I did nix-env -i all -f ~/git/nixpkgs/ all is a meta package in my ~/nixpkgs/config.nix. I'll try just installing ed when I'm home.

  17. vcunat commented on Mar 3, 2017

    @vcunat
    Member

    nix-store --realize /nix/store/8xvkriqhp9f47y6kwciha4wsg1nqfq7p-ed-1.14.1 succeeds for me (fetches from cache.nixos.org).

  18. edolstra commented on Mar 3, 2017

    @edolstra
    Member

    Hm, I can't really explain the 404. It could be a cached response from Cloudfront. However, BinaryCacheStore uploads the .nar.xz before the .narinfo, so I can't see how somebody could have requested that .nar.xz earlier. I can dig in the Cloudfront logs...

  19. despairblue commented on Mar 4, 2017

    @despairblue
    Contributor

    I was on 45344fd. But now it works 😕

    It also downloaded a different file:

    *** Downloading ‘https://cache.nixos.org/nar/19hi73szwgv062pnfg96gdb26sh4062qi9k3akq2adnnraf0bvr9.nar.xz’ (signed by ‘cache.nixos.org-1’) to ‘/nix/store/gvqyqdlcwfqldb99q6kzixm5786al1ka-ed-1.14.1’...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 42952  100 42952    0     0  27736      0  0:00:01  0:00:01 --:--:-- 27728
    
  20. butterflya commented on Mar 7, 2017

    @butterflya
    Contributor

    @edolstra Can't you just do a handover of this service to someone else, since it seems clear that the people currently responsible for running cache.nixos.org are not capable of doing so?

  21. butterflya commented on Mar 7, 2017

    @butterflya
    Contributor

    Also, this code can be improved to use the upload method instead of PutObject. (See the documentation for upload for why.)

         auto result = checkAws(format("AWS error uploading ‘%s’") % path,
                s3Helper.client->PutObject(request));
    

    I couldn't be bothered to look at what checkAws does, but if it merely checks (as opposed to asserts), then this method is not guaranteed to work, obviously. So, I would say that the problem is not as to "that it is weird that it doesn't work", but that you failed to show in your source code with any convincing argument that it should work in the first place. If checkAws does exit the process or abort in some way, then the name should be changed.

  22. domenkozar commented on Mar 7, 2017

    @domenkozar
    Member

    @butterflya patches welcome :)

  23. edolstra commented on Mar 8, 2017

    @edolstra
    Member

    @butterflya You probably should have bothered to look at what checkAws does, because it throws an exception.

    And no, I'm not going to drop S3/Cloudfront because of an occasional 404.

  24. butterflya commented on Mar 8, 2017

    @butterflya
  25. locked and limited conversation to collaborators on Mar 8, 2017
  26. domenkozar commented on Mar 8, 2017

    @domenkozar
    Member

    These one-issue-fits-all always end up the same way: no positive outcome.

    Please, open a new issue if you think something can be fixed and please remember to describe exactly what's going on in your case. Pasting just that S3 retrieval failed is not enough, it could happen due to a few dozen reasons.

    @butterflya pointing fingers and passive aggressive blaming won't help. It never did. Please calm down and unless you can:

    1. suggest exactly and how the current situation can be fixed
    2. pay someone to implement a fix

    join the club and wait until we pin down these issues.

    Half of this thread is already resolved:

    1. S3 was down
    2. @despairblue had DNS issues
    3. @obadz Nix commit fixed it for him

    So we're working on it.

  27. vcunat commented on Mar 8, 2017

    @vcunat
    Member

    What an aggressive reaction from @butterflya! The binary cache is provided completely for free, despite costing real money and lots of work of the community, and outages/problems have seem to be relatively rare in the past few years. Besides, the reliability of upgrades is primarily meant in a slightly different way...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions