On Wed, 23 Apr 2008 20:32:39 +0200 Jose Luis Martinez <[EMAIL PROTECTED]> wrote: > I've been bugging aroung the Qp code to find what's going on with these > processes... What was my surprise when I saw: > > $SIG{ALRM} = sub { > print $client "421 Connection Timed Out\n"; > ::log(LOGINFO, "Connection Timed Out"); > exit; }; > > in the qpsmtpd-forkserver code... just in the portion of code for child > processes :) > > The bad thing is that it is never called, because alarm is never called It should be called (lib/Qpsmtpd/SMTP.pm): sub getline { my ($self, $timeout) = @_; alarm $timeout; my $line = <STDIN>; # default implementation alarm 0; > :S ¿Is there any other way to send yourself ALRMs? kill "ALRM", $$; :-)
> When you send an ALRM to one of the hung processes, it exits... It looks > like this feature got in to forkserver at rev 291... but it seems like > it never worked... Maybe a plugin was supposed to call alarm? Maybe the > parent process was supposed to send the ALRM to a child that has been > working for too long? (that way you don't have to worry about plugins No, see getline() above. The timeout is started when attempting to read one line. Once the line is there, it's switched off. Hmm, what happens if <STDIN> just returns ""? ... should we return undef if $line eq ""; in getline()? [...] > I also saw that in SMTP.pm there are two commented out lines referring > to ALRMs... so it looks like the session timeout was a working feature > at some point... IIRC not a "session timeout", but a "read one line timout"... Hanno