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

504 was not retried while fetching nar #3278

Closed
roberth opened this issue Dec 19, 2019 · 5 comments · Fixed by #3478
Closed

504 was not retried while fetching nar #3278

roberth opened this issue Dec 19, 2019 · 5 comments · Fixed by #3478
Labels

Comments

@roberth
Copy link
Member

roberth commented Dec 19, 2019

Current behavior:

[...]
unable to download 'https://[redacted].cachix.org/nar/[redacted].nar.xz': HTTP error 504
[...]

Expected behavior:

  • perform retries
  • log the retries as warnings as usual
nix show-config

version: nix (Nix) 2.3

nix show-config 
allow-import-from-derivation = true
allow-new-privileges = false
allow-unsafe-native-code-during-evaluation = false
allowed-impure-host-deps = 
allowed-uris = 
allowed-users = *
auto-optimise-store = false
build-hook = /nix/store/...-nix-2.3/libexec/nix/build-remote
build-poll-interval = 5
build-users-group = nixbld
builders = 
builders-use-substitutes = false
compress-build-log = true
connect-timeout = 0
cores = 0
diff-hook = 
download-attempts = 5
enforce-determinism = true
extra-platforms = i686-linux
extra-sandbox-paths = 
extra-substituters = 
fallback = false
filter-syscalls = true
fsync-metadata = true
gc-check-reachability = false
gc-reserved-space = 8388608
hashed-mirrors = http://tarballs.nixos.org/
http-connections = 25
http2 = true
impersonate-linux-26 = false
keep-build-log = true
keep-derivations = true
keep-env-derivations = false
keep-failed = false
keep-going = false
keep-outputs = false
log-lines = 10
max-build-log-size = 0
max-free = 18446744073709551615
max-jobs = 4
max-silent-time = 0
min-free = 0
min-free-check-interval = 5
narinfo-cache-negative-ttl = 3600
narinfo-cache-positive-ttl = 2592000
netrc-file = /etc/nix/netrc
plugin-files = 
post-build-hook = 
pre-build-hook = 
print-missing = true
pure-eval = false
repeat = 0
require-sigs = true
restrict-eval = false
run-diff-hook = false
sandbox = true
sandbox-build-dir = /build
sandbox-dev-shm-size = 50%
sandbox-fallback = false
sandbox-paths = /bin/sh=/nix/store...-busybox-1.30.1/bin/busybox
secret-key-files = 
show-trace = false
stalled-download-timeout = 300
store = auto
substitute = true
substituters = https://cache.nixos.org/
sync-before-registering = false
system = x86_64-linux
system-features = benchmark big-parallel kvm nixos-test
tarball-ttl = 3600
timeout = 0
trace-function-calls = false
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
trusted-substituters = 
trusted-users = hercules-ci-agent
use-case-hack = false
use-sqlite-wal = true
user-agent-suffix = 
@domenkozar domenkozar added the bug label Dec 19, 2019
@edolstra
Copy link
Member

Strange, looking at download.cc all 5xx errors except 501, 505 and 511 should be treated as retriable.

@domenkozar
Copy link
Member

Looking at the code, it seems like this happens with Nix already consumes some of the body.

@domenkozar
Copy link
Member

domenkozar commented Mar 30, 2020

I think this is a bug since 53247d6, Nix will retry only if there is accept-ranges header in the response, but that might not be the case on server errors. In that case Nix should fallback and retry downloading the whole body again (as was the case before this commit).

&& (!this->request.dataCallback
|| writtenToSink == 0
|| (acceptRanges && encoding.empty())))

@domenkozar
Copy link
Member

domenkozar commented Apr 7, 2020

@edolstra how feasible would it be to wait for status to be 2XX in writeCallback before body is consumed? It should really be set then as headers would be parsed before the body.

I think that would solve this and a bunch of other errors: I heard today from @michaelpj he has still seen error 7 while decompressing xz file which could be coming from feeding 500 errors to decompressor.

And I'd really like to backport this to 2.3.x since it's giving headaches to Nix users.

edolstra added a commit to edolstra/nix that referenced this issue Apr 8, 2020
domenkozar pushed a commit to domenkozar/nix that referenced this issue Apr 9, 2020
Hopefully fixes NixOS#3278.

(cherry picked from commit 1ab8d6a)
Signed-off-by: Domen Kožar <domen@dev.si>
edolstra added a commit that referenced this issue Apr 10, 2020
Hopefully fixes #3278.

(cherry picked from commit 1ab8d6a)
Signed-off-by: Domen Kožar <domen@dev.si>
dtzWill pushed a commit to dtzWill/nix that referenced this issue Apr 10, 2020
@hvdijk
Copy link
Contributor

hvdijk commented Jun 15, 2020

This fix broke the downloading of files over FTP with nix-prefetch-url, which for obvious reasons do not result one of the approved HTTP response codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants