On Tue, May 19, 2015 at 01:42:23PM +0800, Michael Deegan wrote:
> Package: apt-cacher
> Version: 1.7.10
> Severity: normal
> 
> Dear Maintainer,
> 
> Hello, after adding HTTPS sources ("deb https://deb.packager.io/gh/pkgr/gogs 
> wheezy pkgr")
> on a client PC I noticed apt-cacher's CPU usage go through the roof.
> 
> Some poking around led to the discovery that ssl_proxy() doesn't appear to
> notice EOF on the upstream connection, leading to an infinite loop. I added
> a debugging message (and a sleep :P) inside the main loop, resulting in:

Thanks. 

Does this patch help?

Mark

commit 4d1675654f73c9e1da808661ea405c3e29f4232e
Author: Mark Hindley <m...@hindley.org.uk>
Date:   Tue May 19 09:30:53 2015 +0100

    In ssl_proxy(),  sysread returns 0 on EOF.

diff --git a/apt-cacher b/apt-cacher
index 1317c25..f1526e8 100755
--- a/apt-cacher
+++ b/apt-cacher
@@ -455,6 +455,7 @@ sub ssl_proxy {
        while (my @pending = $s->can_read($cfg->{request_timeout})) {
            foreach (@pending) {
                if(defined(my $num=sysread($_, my $buf,65536))) {
+                   last unless $num; # EOF
                    local $SIG{PIPE} = sub {$cfg->{debug} && debug_message('Got 
SIGPIPE whilst proxying')}; # Catch disconnects/write failure
                    my $writeto = (fileno($_)==fileno($ssl)?$con:$ssl);
                    last LOOP if !defined(syswrite($writeto,$buf,$num));


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to