On 2008-04-25 09:44:00 +0200, Jose Luis Martinez wrote:
> Peter J. Holzer escribió:
> >Also, explicitely setting $SIG{PIPE} = 'DEFAULT' inside of the alarm
> >handler may help. 
> >
> 
> Perl's default SIG_PIPE behaviour is to eat the signal (if I'm not 
> remembering badly).

Not sure what you mean by "eat the signal". Perl doesn't change the
default action, and forkserver explicitely resets it to default in the
child, so it should die on SIGPIPE (unless a plugin installs a handler).

> But I get the message... exit on SIG_PIPE...

Yep. I suspect that both the mysql and the tls library (openssl?)
install a SIGPIPE handler and they interact badly. By resetting the
SIGPIPE handler to the default (i.e. let the OS kill the process) in the
SIGALRM handler you increase the chances that the process will actually
die in the following print.

> The bad thing is that I don't know where to establish that signal 
> handler, and if it would cause major pain to other plugins :S, because 
> everything seems to happen out of plugin handlers...

In the alarm handler you mainly want to die anyway, so there's not much
to worry about if the process gets killed a little bit earlier.


> >>A better option might be to have the parent process watch for long  
> >>running children and terminate them.
> >
> >Yup, but how long is long? If the client is trying to send a 600 MB
> >email that will take some time ...
> 
> How long is long for a plugin handler? how long is long for a session?
> Different plugins will want different timeout times, and some plugins 
> won't want timeout...

The SMTP standard specifies minimum timeouts for most operations. For
example, the client should wait at least 10 minutes between sending the
final dot and receiving a reply. So all the post_data and queue hooks
together must take less than 10 minutes to run. You can set a timeout
for that. But a child process may receive many mails of different
lengths, so the parent cannot reasonably set a timeout for the child
process. There could be some "dead man switch", where the client
regularly says "I'm still alive and working", and is killed if it
hasn't reported for some time.

> I think that plugin timeouts, if necessary, have to be very well thought 
>  and discussed...

ACK.

        hp

-- 
   _  | Peter J. Holzer    | It took a genius to create [TeX],
|_|_) | Sysadmin WSR       | and it takes a genius to maintain it.
| |   | [EMAIL PROTECTED]         | That's not engineering, that's art.
__/   | http://www.hjp.at/ |    -- David Kastrup in comp.text.tex

Attachment: signature.asc
Description: Digital signature

Reply via email to