nix icon indicating copy to clipboard operation
nix copied to clipboard

Curl error when fetching file using http2

Open ithinuel opened this issue 1 year ago • 0 comments

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;
  };
}
  1. Run nix flake update
  2. See it fetching everything fine
  3. Run nix flake update
  4. 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:

  • nix-direnv only passes it to nix print-dev-env
  • nix flake archive silently ignores it anyways because ignoring the client-specified setting 'http2', because it is a restricted setting and you are not a trusted user

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.

ithinuel avatar Aug 22 '24 00:08 ithinuel

+1 for this.

It makes sense to just check out the branch actually needed and without all the history. This can reduce the cloning time enormously for large repositories with a lot of history.

This seem like it would be a fairly simple change with something like this added to the git invoke:

--branch <rev> --single-branch --depth 1

markopy avatar Feb 22 '21 17:02 markopy

Ran into this exact issue here: https://github.com/python-poetry/poetry/issues/2094#issuecomment-1203314891

Kache avatar Sep 09 '22 12:09 Kache

I had a similar issue when a branch used submodules and the other not, and the non-default would have been the preferred one: #9612

gaborfekete-greehill avatar Aug 09 '24 12:08 gaborfekete-greehill