#1060141 apt-cacher-ng: apt does not resume interrupted downloads when going through apt-cacher-ng

Package:
apt-cacher-ng
Source:
apt-cacher-ng
Description:
caching proxy server for software repositories
Submitter:
Michael Deegan
Date:
2024-01-06 10:48:03 UTC
Severity:
normal
#1060141#5
Date:
2024-01-06 10:38:40 UTC
From:
To:
Dear Maintainer,

Hello,

Recently Spotify's package repository started dropping connections partway
through. You can (hopefully) see this in action via something like:

  wget -t1 http://repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb

The connection will usually get closed partway through the response.

Without a proxy configured, apt will successfully resume the interrupted
download. However, with the proxy (apt-cacher-ng) enabled, the download
restarts from the beginning, and because the whole file never downloads
successfully in one go, it hits apt's retry count. This usually means I
don't get any updates at all, and unfortunate situation.

apt-cacher.log looks like:

  1704535981|M|Download of repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb started
  1704535986|I|2275168|192.168.1.42|repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb [HTTP error, code: 503]
  1704535986|E|2274227|192.168.1.42|repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb [HTTP error, code: 503]
  1704535989|M|Download of repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb started
  1704536008|I|74935484|192.168.1.42|repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb [HTTP error, code: 503]
  1704536008|E|74934543|192.168.1.42|repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb [HTTP error, code: 503]
  1704536013|M|Download of repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb started
  1704536018|I|2087284|192.168.1.42|repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb [HTTP error, code: 503]
  1704536018|E|2086343|192.168.1.42|repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.26.1187.g36b715a1_amd64.deb [HTTP error, code: 503]

Running apt with -o Debug::Acquire::http=true reveals that apt requests a
byte range, but apt-cacher-ng responds with the whole file anyway.

I guess apt-cacher-ng doesn't support Range requests on the client side? I
expect it's because it doesn't want to have to deal with partial files from
upstream, but I suppose apt-cacher-ng's HTTP client could do with some retry
logic (involving Range requests on the upstream) similar to wget's?