Package: apt-cacher-ng Version: 0.8.4-1 Severity: important Tags: patch Control: found -1 apt-cacher-ng/0.8.2-1
Hello, Often, when performing 'apt-get update' with apt-cacher-ng, it would fail with lots of '502 Connection closed' errors, as shown in the attached apt-cacher.err snippet. I don't know why no one else has reported this yet, but maybe it has something to do with slower internet connections. I thought the bug may have been related to Bug #787289, so I tried different PipelineDepth values, but it didn't change anything. I did a bit of debugging and found that the problem first crops up after this commit: https://anonscm.debian.org/cgit/apt-cacher-ng/apt-cacher-ng.git/commit/?h=debian/sid&id=1716a7a94c0e6bfc0635f2aef6e281c10a30a96c Without understanding the code entirely, I tried reverting some of the changes that I thought were suspect, and it seemed to do the trick. I have attached this patch. Hopefully, it doesn't cause problems for others. Best regards, Carlos -- Package-specific info: -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (990, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.0.0-2-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages apt-cacher-ng depends on: ii adduser 3.113+nmu3 ii debconf [debconf-2.0] 1.5.56 ii dpkg 1.18.1 ii init-system-helpers 1.23 ii libbz2-1.0 1.0.6-8 ii libc6 2.19-19 ii libgcc1 1:5.1.1-13 ii liblzma5 5.1.1alpha+20120614-2.1 ii libssl1.0.0 1.0.2d-1 ii libstdc++6 5.1.1-13 ii libsystemd0 222-1 ii libwrap0 7.6.q-25 ii zlib1g 1:1.2.8.dfsg-2+b1 apt-cacher-ng recommends no packages. Versions of packages apt-cacher-ng suggests: ii avahi-daemon 0.6.31-5 ii doc-base 0.10.6 ii libfuse2 2.9.4-1 -- Configuration Files: /etc/apt-cacher-ng/acng.conf changed [not included] /etc/apt-cacher-ng/security.conf [Errno 13] Permission denied: u'/etc/apt-cacher-ng/security.conf' /etc/cron.daily/apt-cacher-ng [Errno 2] No such file or directory: u'/etc/cron.daily/apt-cacher-ng' -- debconf information excluded
Sun Jul 12 16:04:11 2015|created socket, fd: 5 Sun Jul 12 16:04:11 2015|Not creating Unix Domain Socket, fifo_path not specified Sun Jul 12 16:04:11 2015|Listening to incoming connections... Sun Jul 12 16:05:02 2015|Detected incoming connection from the TCP socket Sun Jul 12 16:05:02 2015|Client name: 192.168.0.1 Sun Jul 12 16:05:02 2015|Detected incoming connection from the TCP socket Sun Jul 12 16:05:02 2015|Client name: 192.168.0.1 Sun Jul 12 16:05:02 2015|Detected incoming connection from the TCP socket Sun Jul 12 16:05:02 2015|Client name: 192.168.0.1 Sun Jul 12 16:05:02 2015|Decoded request URI: http://ftp.debian.org/debian/dists/experimental/InRelease Sun Jul 12 16:05:02 2015|Decoded request URI: http://www.deb-multimedia.org/dists/sid/InRelease Sun Jul 12 16:05:02 2015|Decoded request URI: http://security.debian.org/dists/testing/updates/InRelease Sun Jul 12 16:05:02 2015|Processing new job, GET http://ftp.debian.org/debian/dists/experimental/InRelease HTTP/1.1 Sun Jul 12 16:05:02 2015|Processing new job, GET http://www.deb-multimedia.org/dists/sid/InRelease HTTP/1.1 Sun Jul 12 16:05:02 2015|Processing new job, GET http://security.debian.org/dists/testing/updates/InRelease HTTP/1.1 Sun Jul 12 16:05:03 2015|Download started, storeHeader for security.debian.org/dists/testing/updates/InRelease, current status: 1 Sun Jul 12 16:05:03 2015|known data hit, don't write to: security.debian.org/dists/testing/updates/InRelease Sun Jul 12 16:05:03 2015|Response header to be sent in the next cycle: HTTP/1.1 304 Not Modified Content-Length: 0 Date: Sun Jul 12 06:05:03 2015 Server: Debian Apt-Cacher NG/0.8.4 X-Original-Source: http://security.debian.org/dists/testing/updates/InRelease Connection: Keep-Alive Sun Jul 12 16:05:03 2015|Returning to last state, 6 Sun Jul 12 16:05:03 2015|Download started, storeHeader for debmul/dists/sid/InRelease, current status: 1 Sun Jul 12 16:05:03 2015|known data hit, don't write to: debmul/dists/sid/InRelease Sun Jul 12 16:05:03 2015|Response header to be sent in the next cycle: HTTP/1.1 304 Not Modified Content-Length: 0 Date: Sun Jul 12 06:05:03 2015 Server: Debian Apt-Cacher NG/0.8.4 X-Original-Source: http://www.deb-multimedia.org/dists/sid/InRelease Connection: Keep-Alive Sun Jul 12 16:05:03 2015|Returning to last state, 6 Sun Jul 12 16:05:04 2015|Decoded request URI: http://security.debian.org/dists/testing/updates/main/source/Sources.xz Sun Jul 12 16:05:04 2015|Processing new job, GET http://security.debian.org/dists/testing/updates/main/source/Sources.xz HTTP/1.1 Sun Jul 12 16:05:04 2015|Decoded request URI: http://www.deb-multimedia.org/dists/sid/main/source/Sources.bz2 Sun Jul 12 16:05:04 2015|Processing new job, GET http://www.deb-multimedia.org/dists/sid/main/source/Sources.bz2 HTTP/1.1 Sun Jul 12 16:05:04 2015|Download started, storeHeader for debrep/dists/experimental/InRelease, current status: 1 Sun Jul 12 16:05:04 2015|Response header to be sent in the next cycle: HTTP/1.1 200 OK Content-Length: 162310 Last-Modified: Sun, 12 Jul 2015 03:14:05 GMT Content-Type: application/octet-stream Date: Sun Jul 12 06:05:04 2015 Server: Debian Apt-Cacher NG/0.8.4 X-Original-Source: http://ftp.debian.org/debian/dists/experimental/InRelease Connection: Keep-Alive Sun Jul 12 16:05:04 2015|Returning to last state, 1 Sun Jul 12 16:05:05 2015|Download started, storeHeader for security.debian.org/dists/testing/updates/main/source/Sources.xz, current status: 1 Sun Jul 12 16:05:05 2015|known data hit, don't write to: security.debian.org/dists/testing/updates/main/source/Sources.xz Sun Jul 12 16:05:05 2015|Response header to be sent in the next cycle: HTTP/1.1 304 Not Modified Content-Length: 0 Date: Sun Jul 12 06:05:05 2015 Server: Debian Apt-Cacher NG/0.8.4 X-Original-Source: http://security.debian.org/dists/testing/updates/main/source/Sources.xz Connection: Keep-Alive Sun Jul 12 16:05:05 2015|Returning to last state, 6 Sun Jul 12 16:05:05 2015|Download started, storeHeader for debmul/dists/sid/main/source/Sources.bz2, current status: 1 Sun Jul 12 16:05:05 2015|known data hit, don't write to: debmul/dists/sid/main/source/Sources.bz2 Sun Jul 12 16:05:05 2015|Response header to be sent in the next cycle: HTTP/1.1 304 Not Modified Content-Length: 0 Date: Sun Jul 12 06:05:05 2015 Server: Debian Apt-Cacher NG/0.8.4 X-Original-Source: http://www.deb-multimedia.org/dists/sid/main/source/Sources.bz2 Connection: Keep-Alive Sun Jul 12 16:05:05 2015|Returning to last state, 6 Sun Jul 12 16:05:06 2015|Decoded request URI: http://security.debian.org/dists/testing/updates/contrib/source/Sources.xz Sun Jul 12 16:05:06 2015|Processing new job, GET http://security.debian.org/dists/testing/updates/contrib/source/Sources.xz HTTP/1.1 Sun Jul 12 16:05:06 2015|Decoded request URI: http://www.deb-multimedia.org/dists/sid/non-free/source/Sources.bz2 Sun Jul 12 16:05:06 2015|Processing new job, GET http://www.deb-multimedia.org/dists/sid/non-free/source/Sources.bz2 HTTP/1.1 Sun Jul 12 16:05:09 2015|Download started, storeHeader for security.debian.org/dists/testing/updates/contrib/source/Sources.xz, current status: 1 Sun Jul 12 16:05:09 2015|known data hit, don't write to: security.debian.org/dists/testing/updates/contrib/source/Sources.xz Sun Jul 12 16:05:09 2015|Response header to be sent in the next cycle: HTTP/1.1 304 Not Modified Content-Length: 0 Date: Sun Jul 12 06:05:09 2015 Server: Debian Apt-Cacher NG/0.8.4 X-Original-Source: http://security.debian.org/dists/testing/updates/contrib/source/Sources.xz Connection: Keep-Alive Sun Jul 12 16:05:09 2015|Returning to last state, 6 Sun Jul 12 16:05:09 2015|Decoded request URI: http://security.debian.org/dists/testing/updates/non-free/source/Sources.xz Sun Jul 12 16:05:09 2015|Processing new job, GET http://security.debian.org/dists/testing/updates/non-free/source/Sources.xz HTTP/1.1 Sun Jul 12 16:05:09 2015|Download started, storeHeader for debmul/dists/sid/non-free/source/Sources.bz2, current status: 1 Sun Jul 12 16:05:09 2015|known data hit, don't write to: debmul/dists/sid/non-free/source/Sources.bz2 Sun Jul 12 16:05:09 2015|Response header to be sent in the next cycle: HTTP/1.1 304 Not Modified Content-Length: 0 Date: Sun Jul 12 06:05:09 2015 Server: Debian Apt-Cacher NG/0.8.4 X-Original-Source: http://www.deb-multimedia.org/dists/sid/non-free/source/Sources.bz2 Connection: Keep-Alive Sun Jul 12 16:05:09 2015|Returning to last state, 6 Sun Jul 12 16:05:10 2015|Decoded request URI: http://www.deb-multimedia.org/dists/sid/main/binary-amd64/Packages.bz2 Sun Jul 12 16:05:10 2015|Processing new job, GET http://www.deb-multimedia.org/dists/sid/main/binary-amd64/Packages.bz2 HTTP/1.1 Sun Jul 12 16:05:14 2015|Download started, storeHeader for security.debian.org/dists/testing/updates/non-free/source/Sources.xz, current status: 1 Sun Jul 12 16:05:14 2015|known data hit, don't write to: security.debian.org/dists/testing/updates/non-free/source/Sources.xz Sun Jul 12 16:05:14 2015|Response header to be sent in the next cycle: HTTP/1.1 304 Not Modified Content-Length: 0 Date: Sun Jul 12 06:05:14 2015 Server: Debian Apt-Cacher NG/0.8.4 X-Original-Source: http://security.debian.org/dists/testing/updates/non-free/source/Sources.xz Connection: Keep-Alive Sun Jul 12 16:05:14 2015|Returning to last state, 6 Sun Jul 12 16:05:14 2015|Decoded request URI: http://security.debian.org/dists/testing/updates/main/binary-amd64/Packages.xz Sun Jul 12 16:05:14 2015|Processing new job, GET http://security.debian.org/dists/testing/updates/main/binary-amd64/Packages.xz HTTP/1.1 Sun Jul 12 16:05:15 2015|Download started, storeHeader for debmul/dists/sid/main/binary-amd64/Packages.bz2, current status: 1 Sun Jul 12 16:05:15 2015|known data hit, don't write to: debmul/dists/sid/main/binary-amd64/Packages.bz2 Sun Jul 12 16:05:15 2015|Response header to be sent in the next cycle: HTTP/1.1 304 Not Modified Content-Length: 0 Date: Sun Jul 12 06:05:15 2015 Server: Debian Apt-Cacher NG/0.8.4 X-Original-Source: http://www.deb-multimedia.org/dists/sid/main/binary-amd64/Packages.bz2 Connection: Keep-Alive Sun Jul 12 16:05:15 2015|Returning to last state, 6 Sun Jul 12 16:05:15 2015|Decoded request URI: http://www.deb-multimedia.org/dists/sid/non-free/binary-amd64/Packages.bz2 Sun Jul 12 16:05:15 2015|Processing new job, GET http://www.deb-multimedia.org/dists/sid/non-free/binary-amd64/Packages.bz2 HTTP/1.1 Sun Jul 12 16:05:22 2015|Response header to be sent in the next cycle: HTTP/1.1 502 Connection closed Content-Length: 158 Content-Type: text/html Date: Sun Jul 12 06:05:22 2015 Server: Debian Apt-Cacher NG/0.8.4 Connection: Keep-Alive Sun Jul 12 16:05:22 2015|Returning to last state, 1 Sun Jul 12 16:05:22 2015|Decoded request URI: http://security.debian.org/dists/testing/updates/contrib/binary-amd64/Packages.xz Sun Jul 12 16:05:22 2015|Processing new job, GET http://security.debian.org/dists/testing/updates/contrib/binary-amd64/Packages.xz HTTP/1.1 Sun Jul 12 16:05:22 2015|Response header to be sent in the next cycle: HTTP/1.1 502 Connection closed Content-Length: 158 Content-Type: text/html Date: Sun Jul 12 06:05:22 2015 Server: Debian Apt-Cacher NG/0.8.4 Connection: Keep-Alive Sun Jul 12 16:05:22 2015|Returning to last state, 1 Sun Jul 12 16:05:22 2015|Decoded request URI: http://security.debian.org/dists/testing/updates/non-free/binary-amd64/Packages.xz Sun Jul 12 16:05:22 2015|Processing new job, GET http://security.debian.org/dists/testing/updates/non-free/binary-amd64/Packages.xz HTTP/1.1 Sun Jul 12 16:05:22 2015|Response header to be sent in the next cycle: HTTP/1.1 502 Connection closed Content-Length: 158 Content-Type: text/html Date: Sun Jul 12 06:05:22 2015 Server: Debian Apt-Cacher NG/0.8.4 Connection: Keep-Alive Sun Jul 12 16:05:22 2015|Returning to last state, 1 Sun Jul 12 16:05:22 2015|Decoded request URI: http://security.debian.org/dists/testing/updates/main/binary-i386/Packages.xz Sun Jul 12 16:05:22 2015|Processing new job, GET http://security.debian.org/dists/testing/updates/main/binary-i386/Packages.xz HTTP/1.1 Sun Jul 12 16:05:22 2015|Response header to be sent in the next cycle: HTTP/1.1 502 Connection closed Content-Length: 158 Content-Type: text/html Date: Sun Jul 12 06:05:22 2015 Server: Debian Apt-Cacher NG/0.8.4 Connection: Keep-Alive Sun Jul 12 16:05:22 2015|Returning to last state, 1 Sun Jul 12 16:05:22 2015|Decoded request URI: http://security.debian.org/dists/testing/updates/contrib/binary-i386/Packages.xz Sun Jul 12 16:05:22 2015|Processing new job, GET http://security.debian.org/dists/testing/updates/contrib/binary-i386/Packages.xz HTTP/1.1 Sun Jul 12 16:05:22 2015|Response header to be sent in the next cycle: HTTP/1.1 502 Connection closed Content-Length: 158 Content-Type: text/html Date: Sun Jul 12 06:05:22 2015 Server: Debian Apt-Cacher NG/0.8.4 Connection: Keep-Alive
>From 0f916f586b67a04a8ad3c1a9a0811e3da73f3c54 Mon Sep 17 00:00:00 2001 From: Carlos Maddela <madd...@labyrinth.net.au> Date: Thu, 16 Jul 2015 00:35:23 +1000 Subject: [PATCH] Fix '502 Connection closed' bug. --- source/dlcon.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/dlcon.cc b/source/dlcon.cc index 2006e13..c2a4639 100644 --- a/source/dlcon.cc +++ b/source/dlcon.cc @@ -1205,6 +1205,8 @@ void dlcon::WorkLoop() con = doconnect(peerHost, acfg::nettimeout, false); } + nLostConTolerance = MAX_RETRY + bUsed; + ldbg("connection valid? " << bool(con) << " was fresh? " << !bUsed); if(con) @@ -1346,10 +1348,7 @@ void dlcon::WorkLoop() { // disconnected by OS... give it a chance, or maybe not... if (--nLostConTolerance <= 0) - { BlacklistMirror(inpipe.front()); - nLostConTolerance=MAX_RETRY; - } timespec sleeptime = { 0, 325000000 }; nanosleep(&sleeptime, nullptr); @@ -1364,6 +1363,7 @@ void dlcon::WorkLoop() if(loopRes & (HINT_DONE|HINT_MORE)) { + nLostConTolerance=MAX_RETRY; sErrorMsg.clear(); continue; } -- 2.1.4