DITA and XMetaL Discussion
XMetaL Community Forum › DITA and XMetaL Discussion › [java] Exception in thread "main" java.lang.StackOverflowError
-
adamm September 16, 2015 at 5:09 pm
[java] Exception in thread "main" java.lang.StackOverflowError
September 16, 2015 at 5:09 pmParticipants 3Replies 4Last Activity 7 years, 6 months agoI am trying to generate a PDF using XMetaL(R) Author Enterprise 10.0 Version#: 10.0.0.074.
One of my files has a table with over 800 rows. The PDF generation fails with the errors below. Eclipse generation succeeds. If I break up the table to multiple tables with about 150 rows, the PDF generation is successful.
The error log says:
[java] Exception in thread “main” java.lang.StackOverflowError
Which I think results in the subsequent error:
[i18n-preprocess] [Fatal Error] stage2.fo:1:24557: XML document structures must start and end within the same entity.
Can this be fixed?
Thanks,
Adam
Derek Read September 17, 2015 at 12:30 am
Reply to: [java] Exception in thread "main" java.lang.StackOverflowError
September 17, 2015 at 12:30 amWhat is the name of the “deliverable” you select when generating output? There are various different deliverables that will generate PDF and they run different code to do so.
adamm September 17, 2015 at 8:23 pm
Reply to: [java] Exception in thread "main" java.lang.StackOverflowError
September 17, 2015 at 8:23 pmDerek Read September 18, 2015 at 8:54 pm
Reply to: [java] Exception in thread "main" java.lang.StackOverflowError
September 18, 2015 at 8:54 pmLooks like I can reproduce this issue with an unmodified deliverable “XMetaL Enhanced PDF via RenderX XEP” and a very large CALS table.
From what I can tell (or actually, what I suspect is that) the DITA OT is causing Java to perform some highly recursive operation when it is converting the CALS table format to XSL-FO (used to generate the PDF). Java running on Windows has a specific default stack size (which I think is 64k) and that is being exceeded, causing it to raise this error. With Java all memory must be allocated before it starts doing anything and it is specifically designed not to dynamically allocate more as needed (unlike most software). When it runs out of memory it is designed to stop and complain about it.
I'm not sure what would need to be done to the DITA OT code itself to resolve this or if that it even makes sense to try in this particular case, so the easiest solution is to tell Java to set aside more memory for its stack.
When running the DITA OT at the command line you would simply pass the following additional parameter in:
-Xss1024k
or some other value higher than the default 64k, you also might get away with 128k, 256k, 512k, etc…This need was not anticipated and so XMetaL Author Enterprise (all versions) doesn't offer a way to pass this in through its UI. You will need to make a change your installation to enable that. I've asked that we add this to the next release.
In the meantime, for XMetaL Author Enterprise 10, you can make the following changes:
1. Unzip the file I'm attaching and copy the build.xml it contains over the following file:
C:ProgramDataSoftQuadXMetaLSharedDITA_OT2.0pluginscom.xmetal.xmfobuild.xml
2. Launch XMetaL Author Enterprise 10.
3. From the Tools menu select Configure Output…
4. In the Configure Output dialog select the Advanced tab.
5. In the “Other output parameters” section add the following setting:
ANT_PARAM_args.xmfo.java_vmarg = -Xms1024m -Xmx1024m -Xss1024kThe value 1024k is enough to get the DITA OT producing output for my test table containing 800 rows and 2 columns. If you still get a StackOverflowError after making this change you will need to increase that value.
This build.xml file has not been tested with any versions of XMetaL Author Enterprise other than version 10. If anyone runs into similar issues with an older release I would first recommend upgrading to the current release if possible. If not possible, diff this file against what you have installed to see if you can make a similar change in your version, but keep in mind that if there are other differences in unrelated code those could cause other issues for your version.
External References:
- Oracle Java Command Line Reference [-xss]: https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html#wp999540
-
AuthorPosts
- You must be logged in to reply to this topic.