perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Servo <>
Subject mod_perl, pipes, and "No child processes"
Date Tue, 06 Nov 2001 23:10:50 GMT
Hello all.   I'm writing an app that opens a pipe to sendmail, which if
memory serves, forks off a child process of apache to do the pipe, then
exits as soon as it's finished.

I was doing this with MIME::Lite, and it's been working absolutely
splendidly on Linux and on Solaris 7.   However, on Solaris 8 (and I don't
know if this is related to the OS or not) it gives me all sorts of
problems.   Namely, this started after checking the return code on a
MIME::Lite object called $msg after calling the send method.   It usually
returns a 1 on success, but on the new box it was returning 0, despite the
fact that the e-mails were actually going out.

I ended up writing a test on that just opens a filehandle to |
/usr/lib/sendmail -t -ei -eom, then printing to the filehandle, and
closing the filehandle.   If memory serves, it's almost impossible to get
something accurate out of this statement in mod_perl:

open(SENDMAIL, "| /usr/lib/sendmail -t -ei -eom") or do_something();
As that just reports on whether or not an apache child process was able to
spawn, not whether it was actually able to open the pipe to sendmail.

So, that runs fine, then the print works as I actually get the e-mails
it's trying to send, but this bit of code:

close(SENDMAIL) or print STDERR "Filehandle close failed: $!";

spits out: "Filehandle close failed: No child processes"

Any ideas what is causing this?   Like I said, the mail goes out fine, but
it makes it pretty difficult to check the return code since it's always
coming back false.

In a related note, if anyone is feeling generous, do you know if
$SIG{'CHLD'} gets called only when a child process exits on an error, or
does it get called no matter how a child exits, even if it's gracefully
like it's supposed to?

Brian Nilsen

View raw message