NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.74k stars 1.52k forks source link

Curl error when fetching file using http2 #11352

Open ithinuel opened 2 months ago

ithinuel commented 2 months ago

Describe the bug

Fetching a tarball from a URL prints several warning: error: messages

Steps To Reproduce

  1. Copy this flake:

    {
    description = "A very basic flake";
    
    inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
    
    archive.url = "https://developer.arm.com/-/cdn-downloads/permalink/Fixed-Virtual-Platforms/FM-11.26/FVP_Base_RevC-2xAEMvA_11.26_11_Linux64.tgz";
    archive.type = "file";
    archive.flake = false;
    };
    
    outputs = { self, nixpkgs }: {
    packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;
    packages.x86_64-linux.default = self.packages.x86_64-linux.hello;
    };
    }
  2. Run nix flake update

  3. See it fetching everything fine

  4. Run nix flake update

  5. Prints:

    warning: error: unable to download 'https://developer.arm.com/-/cdn-downloads/permalink/Fixed-Virtual-Platforms/FM-11.26/FVP_Base_RevC-2xAEMvA_11.26_11_Linux64.tgz': HTTP error 200 (curl error: Failure when receiving data from the peer); retrying in 262 ms
    warning: error: unable to download 'https://developer.arm.com/-/cdn-downloads/permalink/Fixed-Virtual-Platforms/FM-11.26/FVP_Base_RevC-2xAEMvA_11.26_11_Linux64.tgz': HTTP error 200 (curl error: Failure when receiving data from the peer); retrying in 518 ms
    warning: error: unable to download 'https://developer.arm.com/-/cdn-downloads/permalink/Fixed-Virtual-Platforms/FM-11.26/FVP_Base_RevC-2xAEMvA_11.26_11_Linux64.tgz': HTTP error 200 (curl error: Failure when receiving data from the peer); retrying in 1409 ms
    warning: error: unable to download 'https://developer.arm.com/-/cdn-downloads/permalink/Fixed-Virtual-Platforms/FM-11.26/FVP_Base_RevC-2xAEMvA_11.26_11_Linux64.tgz': HTTP error 200 (curl error: Failure when receiving data from the peer); retrying in 2367 ms
    warning: error: unable to download 'https://developer.arm.com/-/cdn-downloads/permalink/Fixed-Virtual-Platforms/FM-11.26/FVP_Base_RevC-2xAEMvA_11.26_11_Linux64.tgz': HTTP error 200 (curl error: Failure when receiving data from the peer); using cached version

Expected behavior

The command to execute without warning or error.

nix-env --version output

nix-env (Nix) 2.18.5

Additional context

Adding --option http2 false works around the issue but:

Running with nix flake update --debug -v shows the following lines right before the warning: error::

curl: Failure writing output to destination, passed 60 returned 0
curl: process_pending_input: nghttp2_session_mem_recv() returned -902:The user callback function failed
curl: Connection #4 to host developer.arm.com left intact
finished download of 'https://developer.arm.com/-/cdn-downloads/permalink/Fixed-Virtual-Platforms/FM-11.26/FVP_Base_RevC-2xAEMvA_11.26_11_Linux64.tgz'; curl status = 56, HTTP status = 200, body = 0 bytes

Priorities

Add :+1: to issues you find important.

mikepurvis commented 1 month ago

My colleague hit this running Nix 2.24.6 in WSL2. It was resolvable by adding http2 = false to the nix.conf, but obviously that's a workaround— http2 connections should work.

ctheune commented 1 week ago

Sounds like this could be a duplicate of #9664.