larryk has asked for the wisdom of the Perl Monks concerning the following question:
In a command line context it Just Works and I get the expected SVG output. In the CGI context it gets as far as the call to fdp.exe, which never returns. Apache eventually times-out and gives up trying to serve the page. The fdp.exe (sub)process runs forever (until I kill it manually) with 0% CPU and ~3MB RAM.
I can simulate the issue by calling `fdp -T svg` with no input. That similarly waits forever for input.
GraphViz2 uses IPC::Run::run to call fdp.exe and it is supposed to provide input to fdp. Since this is working on the command line, I suspect it's an issue with IPC::Run::run and mod_cgi but I can't find any comments on the web about IPC::Run::run not working under mod_cgi on Windows with regards to passing STDIN to subprocesses :|
Here's the simplest example exhibiting the issue:
Any ideas?#!C:\Perl64\bin\perl use strict; use warnings; use CGI; use GraphViz2; my $q = CGI->new(); print $q->header('image/svg+xml'); my $g = GraphViz2->new(global => { driver => 'C:\Program Files (x86)\G +raphviz2.30\bin\fdp.exe' }); $g->add_node(name => 'test'); $g->run(format => 'svg'); print $g->dot_output();
Update:
With IPC::Run debugging on (IPCRUNDEBUG=gory) I ran the script once on the command line (which works) and again as a CGI (which doesn't) to compare the debug output.
There are no error messages or warnings and except for the PIDs, about the only difference I can see is that as a CGI, all the paths (temp file, path to executable) contain double backslashes, whereas from the command line invocation the debug output has only single backslashes:
[CGI] IPC::Run 0008 01234567890123 [#1(5888)]: cmd line: "C:\\Program +Files (x86)\\Graphviz2.30\\bin\\fdp.exe" -Tsvg [CLI] IPC::Run 0008 01234567890123 [#1(5472)]: cmd line: "C:\Program F +iles (x86)\Graphviz2.30\bin\fdp.exe" -Tsvg
The input to fdp.exe is successfully written to a temp file in both cases and the fdp.exe process is successfully started in both cases.
I guess I'll just file a bug against IPC::Run and workaround the problem by snaffling the input to fdp.exe directly from the GraphViz2 object internals (gotta love Perl :) and calling fdp.exe myself NOT using IPC::Run. *shrug*
larryk perl -le "s,,reverse killer,e,y,rifle,lycra,,print"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: IPC::Run::run not working under mod_cgi on Windows?
by mtmcc (Hermit) on Jul 26, 2013 at 15:40 UTC | |
by larryk (Friar) on Jul 29, 2013 at 07:12 UTC | |
Re: IPC::Run::run not working under mod_cgi on Windows?
by Anonymous Monk on Jul 26, 2013 at 13:12 UTC | |
Re: IPC::Run::run not working under mod_cgi on Windows?
by Anonymous Monk on Jul 29, 2013 at 07:37 UTC | |
by larryk (Friar) on Jul 29, 2013 at 07:57 UTC |