Weird IPC/Apache issue

Randy J. Ray rjray at
Wed Jan 20 18:22:53 GMT 2010

Mark Fowler wrote:
> On Tue, Jan 19, 2010 at 10:21 PM, Matt Lawrence
> <matt.lawrence at> wrote:
>> 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.

Initially, I drew up a plan for a daemon-ish Perl module that would handle
requests and filter the text through bogofilter. But the way bogofilter wants
to run off of the command-line doesn't help the matter. It's not impossible,
but it isn't easy (or clear, or even just mildly-challenging) either.

I solved the problem by using IPC::Run, which works under Apache2/mod_perl2 as
well as non-Apache environments. It's a neat little module (that I blogged
about a while back), that does things in a nicely Perlish way.

> 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 ;-)

True, but it closely parallels the design I've already been toying with, so
there is some reassurance there. At least I was thinking along similar lines
(though I hadn't considered Gearman or other tools).

Randy J. Ray      Sunnyvale, CA   rjray at

Silicon Valley Scale Modelers:

More information about the mailing list