Xulrunner crash when running with underprivileged user

Posted on

Problem :

I use SlimerJs as an headless browser on a server.
Because the server have no xserver I used xvfb to run it.

The command goes something like this:

xvfb-run --server-args="-screen 0, 1024x768x24" slimerjs-0.10.0pre/slimerjs 
script.js --debug=yes "/tmp/file986Iww" "/tmp/file28bAEv" "pdf"

The file script.js takes a file name for input, a file name for output and a format to convert to, using slimer’s printer capability.

My problem is that when running as root, it works fine. But when I let apache do the work it fails and get stucks.

Apache runs under www-data user and group. This is the output of the previous command:

slimerjs-0.10.0pre/xulrunner/xulrunner -app slimerjs-0.10.0pre/application.ini --profile /tmp/slimerjs.gRAJJar6 -no-remote script.js --debug=yes /tmp/file986Iww /tmp/file28bAEv pdf
Xlib:  extension "RANDR" missing on display ":99".
JavaScript warning: resource://slimerjs/slUtils.jsm, line 154: JavaScript 1.7's let blocks are deprecated
JavaScript error: jar:file:///var/www/project/slimerjs-0.10.0pre/xulrunner/omni.ja!/components/XULStore.js, line 66: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIProperties.get]
** stuck forever here **

The line 66 of XULStore.js is:

65. Services.obs.addObserver(this, "profile-before-change", true);
66. this._storeFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
67. this._storeFile.append(STOREDB_FILENAME);

Trying to see what is wrong with strace show me that it is stuck in some kind of loop…

I see no reasons why this user can’t run this binary.
How can I debug what permission is missing or what is going wrong with xulrunner ?

I did not post the strace because it’s quite heavy, feel free to ask for it if you feel it may contain relevant informations.

$ uname -a
Linux *host* 3.10-0.bpo.2-amd64 #1 SMP Debian 3.10.5-1~bpo70+1 (2013-08-11) x86_64 GNU/Linux

Solution :

You may not have permissions to access or write to the profile directory you are attempting to retrieve.

Although you are (presumably) attempting to set the profile directory via --profile /tmp/slimerjs.gRAJJar6 the SlimerJS documentation indicates this should be -profile (single dash)

By default, if you omit the profile option, as it appears you are doing due to the double dash vs. single dash, then “SlimerJS [will] create a temporary profile each time you launch it” by making a new directory in “$HOME/.innophi/slimerjs/”

Since you are attempting to run this as www-data check their home directory and verify that you can create and access files in the SlimerJS default directory path or use -profile instead of --profile and verify you can create and access files in the specified folder.

Leave a Reply

Your email address will not be published. Required fields are marked *