Forum How do I...?

Princexml and Catalyst

I'm calling princexml from a Catalyst View (perl) on a webserver. The invocation of prince looks something like this:

system("/usr/local/bin/prince --input=html --baseurl=http://dev" .
                     " -o /tmp/xFEWSDFdfd /tmp/xdFEFEfd");


The command is invoked when a certain url is visited on my website.

After invoking the command, I can see the prince process running in the background, but it never completes. I am able to invoke the same command from the command-line without any issues.

I know the catalyst server performs some custom signal-handling. Therefore, I've tinkered around with sending some signals (SIGTTIN, SIGTTOU, etc) to the princexml process, without success.

Is this a limitation of the 'Personal' edition of the product? OR is there a way to do this?
mikeday
It could be trying to write some error messages and blocking because no one is reading them. Try passing --silent and --log=/tmp/prince.log or something like that.
If there are error messages, then the prince executable terminates properly.

I only have problems when it appears that there are no errors. Running in --silent mode does not solve the problem. I think it has to be blocking on writing the output.
mikeday
Is anything at all showing up in the log file? Are there remote images in the input file that could be taking time to download? You could try passing --no-network on the command-line to disable HTTP access, that will eliminate network delay as a possible cause.
After doing some more investigation, I've narrowed down the problem some more.

The prince executable is attempting to access the external network to download referenced content in the html page. For some reason, this causes the process to block (perhaps waiting for http response). I think this might be related to the web-server environment that I'm using.

Using --no-network and 'file://' links instead of 'http://' in the iframe, img and object tags helps a little.
It turns out that the debug server for catalyst can only reply to requests on a single thread. Therefore the server would deadlock if there were http requests within the page being rendered for the same catalyst debug server.

Princexml wasn't at fault.