Skip Menu |

This queue is for tickets about the Net-Server CPAN distribution.

Report information
The Basics
Id: 11695
Status: resolved
Priority: 0/
Queue: Net-Server

People
Owner: Nobody in particular
Requestors: dietmar [...] maurer-it.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.87
Fixed in: (no value)



Subject: interrupted flock system call
Hi all, I detected a serious problem with the PreFork[Simple] Servers. It is possible that the flock system call (inside accept()) gets interrupted, and this seems to shut down all servers: Feb 28 16:49:34 localhost /usr/bin/proxprox[15043]: 2005/02/28-16:49:34 Couldn't get lock on file "/tmp/file5C7ZXb" [Interrupted system call] at line 241 in file /usr/share/perl5/Net/Server/PreForkSimple.pm Feb 28 16:49:34 localhost /usr/bin/proxprox[15043]: 2005/02/28-16:49:34 Server closing! Feb 28 16:49:34 localhost /usr/bin/proxprox[13136]: 2005/02/28-16:49:34 Server closing! The attached patch solves the problem. I use Version 0.87 of Net::Server on debian sarge. perl version: v5.8.4 built for i386-linux-thread-multi Linux version: Linux tequila 2.6.8-1-686 #1 Thu Nov 25 04:34:30 UTC 2004 i686 GNU/Linux
--- PreForkSimple.pm.org 2005-03-01 11:31:36.000000000 +0100 +++ PreForkSimple.pm 2005-03-01 11:35:55.000000000 +0100 @@ -21,7 +21,7 @@ use strict; use vars qw($VERSION @ISA $LOCK_EX $LOCK_UN); -use POSIX qw(WNOHANG); +use POSIX qw(errno_h WNOHANG); use Fcntl (); use Net::Server (); use Net::Server::SIG qw(register_sig check_sigs); @@ -238,8 +238,11 @@ if( $prop->{serialize} eq 'flock' ){ open(LOCK,">$prop->{lock_file}") || $self->fatal("Couldn't open lock file \"$prop->{lock_file}\" [$!]"); - flock(LOCK,Fcntl::LOCK_EX()) - || $self->fatal("Couldn't get lock on file \"$prop->{lock_file}\" [$!]"); + + while( !flock(LOCK,Fcntl::LOCK_EX()) ) { + next if ( $! = EINTR ); + $self->fatal("Couldn't get lock on file \"$prop->{lock_file}\" [$!]"); + } }elsif( $prop->{serialize} eq 'semaphore' ){ $prop->{sem}->op( 0, -1, IPC::SysV::SEM_UNDO() )