Forum Bugs

Prince 6.0r6-linux is 25x slower if HOME env var not defined

Chris Thorman
I had a situation where suddenly my new version of prince 6.0r6 was running much slower than previously (25x -- a doc that used to render in .2 seconds was now taking 5 seconds. (I think this was the prior version was 6.0r3 or 6.0r5 though I haven't thoroughly regression tested.)

WORKAROUND:

I found that it ran fast when the HOME environment variable was defined (set to the same HOME directory as the user account in which prince was installed). When HOME was not set, or was set incorrectly, it ran 25x slower.

I don't believe this was required in the prior versions; they were formerly running in the similar ENV-free situation.

(Even though there is a workaround, isn't it considered a bug, possibly even a security flaw, for prince to rely on any environment variable settings at all?)

To reproduce: run prince normally, then with "env -i", then try turning off all env vars except HOME:

prince test.html -o test.pdf ## fast
env -i prince test.html -o test.pdf ## slow
env -i HOME=/home/pdfserver prince test.html -o test.pdf ## fast again
mikeday
This issue is probably caused by running the generic static Linux package on a distribution with a different version of fontconfig. The recommended fix is to use an appropriate package for your distribution, eg. one of the RPM packages.
colleenm
I have tried this and gotten similar results, although in my particular situation it only seems to matter from the web (things run plenty fast on the command line).

We have both the RPM v6 and non-RPM v7 on our server.

Using v7 without specifying HOME, the command (executed via php) to generate a PDF was taking 2.5 seconds. Specifying HOME cut it to 0.08s.

Using v6 without HOME took 0.32s. With HOME, 0.05s.

I don't claim to know enough about Prince to know why this might be, but there does seem to be something to the original post.
mikeday
Again I think the issue here is a library that Prince uses, probably Fontconfig, which is checking for user-specific settings. May I ask which Linux distribution you are running Prince on?
colleenm
We're using CentOS v5.3.
mikeday
Have you tried the CentOS 5.2 RPM package for Prince 6.0 rev 8 that is now available?