Weird IPC/Apache issue

Randy J. Ray rjray at
Tue Jan 19 21:35:04 GMT 2010

I have a module that uses IPC::Open3 (or IPC::Open2, both exhibit this problem)
to call an external binary (bogofilter in this case) and feed it some input via
the child-input filehandle, then reads the result from the child-output handle.
The code works fine when run in most environments. However, the main use of
this module is in a web service that runs under Apache 2.2.6. And under that
environment, I get the error:

Cannot fdopen STDOUT: Invalid argument

This only happens when the code runs under Apache. Previously, the code
constructed a horribly complex command, which included a here-document for the
input, and ran it with back-ticks. THAT worked, but was very slow and prone to
breaking in unique and perplexing ways. I would hate to have to revert to the
old version, but I cannot crack this.

(If it helps, I'm using the list-form in open3 to specify the command, not a
single string since that would invoke an extra bash process.)

Randy J. Ray      Sunnyvale, CA   rjray at

Silicon Valley Scale Modelers:

More information about the mailing list