Forum Bugs

Prince 9.0.5 *** Mercury runtime: caught segmentation violation ***

Jens Breitenstein
Dear Prince Team!

We frequently (not always) get

*** Mercury runtime: caught segmentation violation ***
cause: unknown
address involved: (nil)
This may have been caused by a stack overflow, due to unbounded recursion.
exiting from signal handler


From the forum we noticed a similar exception occurred in Prince 7.1 but it was stated to be fixed in 8 and newer. We saw it's possible to define stack and heap size used by the mercury runtime so any suggestions which values to set in case of generating large documents (3000 … 7000 pages)? Unfortunately we can not generally reproduce it, sometimes it fails and a later run completes successful...


Thanks in advance

Jens

mikeday
Which version of Prince are you running, on which operating system, and which Prince package did you install?

Even if the problem does not happen every time, is there a document which makes it occur say 25% of the time?
Jens Breitenstein
Sorry for the late reply

We use Linux .. 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3+deb7u2 x86_64 GNU/Linux, Prince 9.0.5
It's reproducable but we found some more details

a) When starting prince directly from a unix-shell it works.
b) Due to the fact we mainly use JAVA in our project we are calling prince via ProcessBuilder. And the same html file, same css files always fail.

Maybe it's a limitation introduced by the ProcessBuilder itself when starting a new Shell…
mikeday
Perhaps shared libraries, current working directory, or some kind of fork issue. But it still really shouldn't segfault. Are you able to run it with --debug and capture any log output?
Jens Breitenstein
prince: debug: loading license: /.../prince-9.0r5/license/license.dat
prince: loading style sheet: /home/.../prince-9.0r5/style/fonts.css
prince: debug: loaded resource: /.../prince-9.0r5/style/fonts.css
prince: debug: loaded resource: type: no
prince: Loading document...
prince: loading XML input: /.../archive-temp/val-prince.html

*** Mercury runtime: caught segmentation violation ***
cause: unknown
address involved: (nil)
This may have been caused by a stack overflow, due to unbounded recursion.
exiting from signal handler




On my mac it looks like this (using a 10 page test file)

prince: debug: loading license: /.../prince-9.0r5/license/license.dat
prince: debug: enumerate font families
prince: debug: font scan: .Aqua Kana
...
prince: debug: font scan: Zapfino
prince: loading style sheet: /.../prince-9.0r5/style/fonts.css
prince: debug: loaded resource: /.../prince-9.0r5/style/fonts.css
prince: debug: loaded resource: type: no
prince: Loading document...
prince: loading XML input: /.../val-prince.html
prince: debug: loaded document: /.../archive-temp/val-prince.html
prince: debug: sniffed doctype: XHTML
prince: Applying style sheets...
prince: loading style sheet: /.../prince-9.0r5/style/xhtml-ns.css
prince: debug: loaded resource: /.../prince-9.0r5/style/xhtml-ns.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /.../prince-9.0r5/style/common.css
prince: debug: loaded resource: /.../prince-9.0r5/style/common.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /_shared_/..../prince-9.0r5/style/hyph.css
prince: debug: loaded resource: /.../prince-9.0r5/style/hyph.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /.../prince-9.0r5/style/mathml.css
prince: debug: loaded resource: /.../prince-9.0r5/style/mathml.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /.../prince-9.0r5/style/svg.css
prince: debug: loaded resource: /.../prince-9.0r5/style/svg.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /.../archive-temp/boom.css
prince: debug: loaded resource: /.../archive-temp/boom.css
prince: debug: loaded resource: type: no
prince: loading style sheet: /.../archive-temp/boom-gdi.css
prince: debug: loaded resource: /.../archive-temp/boom-gdi.css
prince: debug: loaded resource: type: no
prince: Preparing document...
prince: Converting document...
prince: debug: pack
prince: debug: font request: Gill Sans, sans-serif
prince: debug: scan fonts: Gill Sans

prince: used font: Courier New, Regular
prince: Resolving cross-references...
prince: debug: pack
prince: debug: writing output: /.../report.pdf
prince: Finished: success



Any chance to increase the log level?
mikeday
You could pass "-i html" to force Prince to use the HTML parser instead of XML parser. If it works, that would suggest that perhaps the libxml2 library version could be an issue.
mikeday
Any update on this issue? Is it still occurring?
ThePrintingSquirrel
We have a similar error:

*** Mercury runtime: caught segmentation violation ***
This may have been caused by a stack overflow, due to unbounded recursion.
exiting from signal handler


Using
--debug
stopped the error from occurring, as did using the
-i html
option.

This is with Prince 14 on Windows 10.

The full command line command used is (with some details redacted):

prince.exe --baseurl=http://local.xxxxx.com --media=print --pdf-profile="PDF/A-1a" --pdf-lang=en --tagged-pdf --style=C:\work\web-team-tools\convert-html-to-pdf\css\contents-page.css --pdf-title="Contents" --pdf-subject="xxxxx" --pdf-author="xxxxx" --structured-log=normal --script=C:\work\web-team-tools\convert-html-to-pdf\js\preFlight.js C:\Work\xxxxx\publications\xxxxx\2022\oct\00-1-contents.html --output=C:\Work\xxxxx\publications\xxxxx\2022\oct\pdf\00-1-contents.pdf
mikeday
Would you be able to email me (mikeday@yeslogic.com) the HTML and CSS by any chance?
ThePrintingSquirrel
That's done.
mikeday
Thanks, we have now released Prince 14.4 with a fix for this issue.