[sf-perl] Weird IPC/Apache problem
Jonathan Swartz
swartz at pobox.com
Tue Jan 19 16:29:46 PST 2010
Could it be because mod_perl 2 closes STDOUT? I just discovered this
and posted about it:
http://marc.info/?l=apache-modperl&m=126296015910250&w=2
I think it's a nasty bug, but no one seems to care about it thus far.
Post a follow up on the mod_perl list if your problem is related.
Jon
On Jan 19, 2010, at 4:37 PM, Randy J. Ray wrote:
> (I've posted this to Stackoverflow.com and one other PM list, so
> apologies if
> anyone happens to see this twice)
>
> 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.
>
> I don't know if it makes a difference, but I'm using the list-form
> when I call
> open3 ("open3($chld_in, $chld_out, $chld_err, @command_and_args)")
> rather than
> a string, so as to avoid the extra bash process.
>
> Randy
> --
> """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
> Randy J. Ray Sunnyvale, CA http://www.rjray.org rjray at blackperl.com
>
> Silicon Valley Scale Modelers: http://www.svsm.org
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
More information about the SanFrancisco-pm
mailing list