Weird IPC/Apache issue

Mark Fowler mark at
Wed Jan 20 06:46:46 GMT 2010

On Tue, Jan 19, 2010 at 10:21 PM, Matt Lawrence
<matt.lawrence at> wrote:

> Randy J. Ray wrote:
>> I have a module that uses IPC::Open3 (or IPC::Open2, both exhibit this
>> problem) to call an external binary (bogofilter in this case)

> In my limited experience, running any subprocess in mod_perl is fraught with
> difficulty

Another option is not to actually run the process from Apache2 at all,
but rather have a separate long running daemon that handles the
execution for you which you hand off work to from Apache2, thus
avoiding the need to fork at all.  This is most useful as forking new
processes is quite expensive and a bunch of unplanned forks without
rate limiting could be used to DoS your site.

Depending on the reliability and speed of what you want to do, I'd
suggest looking at Gearman (if someone is interactively waiting for
the result) or TheSchwartz (if they're not and you can "defer" the
work to be carried out a few seconds later in a reliable way.)  (YMMV,
other queue systems are available)

Of course, you've just asked "how do I do this simple thing X" and
I've said "Do this more complex thing to your architecture Y", but
that's the nature of advice on the internet ;-)

Mark. - my Perl Blog.

More information about the mailing list