[Catalyst] Running system commands under FastCGI with IPC::Cmd / IPC::Run

Ian Sillitoe ian at sillit.com
Fri Oct 22 09:19:37 GMT 2010


Ah cool - many thanks to all.

I can confirm that updating FCGI to 0.71 fixes the issue when using IPC::Run
explicitly. The following now works as expected under FCGI:

    my ($in, $out, $err);
    my $success =3D IPC::Run::run \@cmd_args, \$in, \$out, \$err,
IPC::Run::timeout( 10 );

Just out of interest - the following still doesn't work:

    my ($success, $error_code, $full_buf, $out_buf, $err_buf) =3D
IPC::Cmd::run(
            command =3D> \@cmd_args,
            verbose =3D> 0,
            timeout =3D> 10,
        );

It goes past the timeout and the log has the error:

     "Could not dup 'STDIN': Invalid argument"

I haven't looked under the hood but this doesn't seem to be anything to do
with Catalyst so I'll take it away from this mailing list - I'll investigate
further and log it with IPC::Cmd if necessary.

Thanks again,

Ian




On 22 October 2010 05:34, Toby Corkindale <toby at dryft.net> wrote:

> On 22 October 2010 05:43, Ian Sillitoe <ian at sillit.com> wrote:
> > I have a Catalyst model that runs a system command as part of a search
> > facility. The system call only takes a fraction of a second so is
> processed
> > inline and this all works fine when tested outside of Catalyst and when
> > called under the Catalyst standalone server. However, when I deploy it =
to
> my
> > FastCGI environment I have problems - everything seems to work fine apa=
rt
> > from the results of the system call.
> >
> > The system call is (give or take):
> >
> >     IPC::Cmd::run(
> >             command =3D> [qw/ blastall -d sequences.db -i input.fa -o
> > output.results /],
> >             verbose =3D> 0,
> >             timeout =3D> 10,
> >         );
>
> I recall that IPC::Run certainly has known-issues when used under
> FastCGI, and I'm guessing they extend to IPC::Cmd too.
>
> Have a look at IPC::Run::SafeHandles which I think got around it.
>
> Toby
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



-- =

Ian Sillitoe
CATH Team -- http://www.cathdb.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20101022/ac09f=
a47/attachment.htm


More information about the Catalyst mailing list