On Thu, Sep 10, 2009 at 10:33:28AM +0100, Mark Hindley wrote: > On Wed, Sep 02, 2009 at 12:22:00PM -0400, Daniel Richard G. wrote: > > After a few hundred cycles of testing, this patch is looking solid. > > Running with checksumming enabled, and debugging disabled, error.log and > > db.log remain at zero size. > > > > Oh, but there was one minor issue. I was previously seeing this warning > > come up repeatedly in error.log: > > > > Tue Sep 1 18:10:46 2009|warn [25867]: Use of uninitialized value > > $cache_status in concatenation (.) or string at apt-cacher2 line 1053. > > > > That's from the print() statement in writeaccesslog(). Apparently, the > > $cache_status variable in handle_connection() was not getting set to > > anything. I worked around this by initializing the variable with a > > value, but I don't think this is what should be happening. Not only are > > there checks further down that seem to account for an unset value---of > > 50K+ lines in the access.log file here, almost 92% of them show the > > initial value that I put in. > > Could you try this patch and see if it is fixed for you.
Sorry, that was incomplete. You will also need this: Mark commit d7bb082eec02cfc354dde25ed423990ac32940bb Author: Mark Hindley <[email protected]> Date: Thu Sep 10 11:41:50 2009 +0100 connect_curlm() is sometimes called whilst holding global_lock. Use a private lockfile to prevent race to create curl socket after fork. diff --git a/apt-cacher b/apt-cacher index 5203b9a..9cb3ebc 100755 --- a/apt-cacher +++ b/apt-cacher @@ -1118,10 +1118,15 @@ sub debug_callback { sub connect_curlm { my $conn; # Check for running server - &set_global_lock(": connect libcurl"); + # Use a lockfile to prevent race on new socket after fork + sysopen(my $curllock, "$cfg->{cache_dir}/private/curllock", O_RDONLY|O_CREAT) || + die "Unable to open curl fork lockfile: $!\n"; + flock($curllock, LOCK_EX)|| die "Unable to lock curl fork lockfile: $!\n"; + if ($conn= IO::Socket::UNIX->new($cfg->{libcurl_socket})) { debug_message("Connection to running libcurl process found on $cfg->{libcurl_socket}"); - &release_global_lock; + flock($curllock, LOCK_UN)||die "Unable to unlock curl fork: $!\n"; + close($curllock); } else { my $lc_pid=fork(); @@ -1142,7 +1147,8 @@ sub connect_curlm { or die "Unable to create libcurl socket $cfg->{libcurl_socket}: $!"; chmod 0600, $cfg->{libcurl_socket} or die "Unable to set permissions: $!"; - &release_global_lock; + flock($curllock, LOCK_UN)||die "Unable to release curl fork lock: $!\n"; + close($curllock); my $select = IO::Select->new($server) or die "Unable to create select: $!"; my $curlm = new WWW::Curl::Multi; -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

