Getting stack overflow error converting from Twiki

Getting the following error when trying to use the CLI to convert a Twiki for Confluence 4.1.4:

Exception in thread "main" java.lang.StackOverflowError
at java.util.regex.Pattern.sequence(
at java.util.regex.Pattern.expr(
at java.util.regex.Pattern.group0(
at java.util.regex.Pattern.sequence(
at java.util.regex.Pattern.expr(
at java.util.regex.Pattern.compile(
at java.util.regex.Pattern.<init>(
at java.util.regex.Pattern.compile(
at com.atlassian.uwc.hierarchies.TWikiHierarchy.getAncestors(
at com.atlassian.uwc.hierarchies.TWikiHierarchy.getAncestors(
at com.atlassian.uwc.hierarchies.TWikiHierarchy.getAncestors(
at com.atlassian.uwc.hierarchies.TWikiHierarchy.getAncestors(




4 answers

Have you turned up the java VM memory numbers? What is the command line you're using to run the command?

You can use the -Xmx8m argument to (for instance) increase the memory for the VM to 8meg. You might need a lot mor than that!

Example file

public class toy
        public static void main(String[] args)
                Runtime runtime = Runtime.getRuntime();

                System.out.println("Total Memory: " + 
		runtime.maxMemory() / (1024 * 1024) + "mb");


Example compile:

% javac
Example run with default:
% java toy
Total Memory: 81mb

Example run with 111 meg of heap:

% java -Xmx111m toy
Total Memory: 108mb

Increase away! It won't hurt anything, change anything permanently, etc. It will make it slower especially if the machine doesn't have enough RAM but it'll have a chance. Like on PC's where the first thing you do is reboot, in Java, the 1st thing you look for is "not enough memory". From the stack indications (line numbers) its a memory kabooey due to recursion. You might have to turn the thing up to 100, 200, 500m, who knows?


I did tweak the parameters but it didn’t fix it. (I increased Xmx and Xss) Here is the relevant line in the script:

java -Xms256m -Xmx1024m -Xss64m $APPLE_ARGS -classpath $CLASSPATH com.atlassian.uwc.ui.UWCCommandLineInterface $1 $2 $3 $4

Since its blowing up on the stack, I'd say increase the stack wildly, or, leave the arg out, and let the VM proportion it to the VM size in general. Your choice! Good luck! G.

The Xss arg was originally not there and was added to do just as you recommended, increase the stack size. I also tried it at 1024 and it just took longer to blow up.


Well, darn it. Good luck!...maybe you can try it on another platform...elsewise, I'd say you have a bonafide bug! [to report]

Idea: can you make a copy of the Twiki, and cut it roughly in half, and see if the bug occurs again? If you keep cutting in half, down to small pieces you'll discover one or more of the following:

- Its a size problem, and/or

- Its a problem with the page content


I think part of the problem is because we are trying to use the UWC for Confluence 4.1, which is not supported in current version of UWC. The other part could have been an unexpected condition in the data. I deleted files in pub and data for a couple of users and it got past this error.

Additionally, there were several "can't find parent" errors for documents (they really did have parents) but they did not stop UWC from completing, however not everything was converted.

That's a lot better! Good luck with the remainder!


I'm having the same problelm. The pages reported as "no parent" do have parents specified. Was there anything specific about the files you deleted?

OK, this problem is this.

Twiki somehow allows for circular reference in pages, e.g. page B can be a child of A which in turn can be a child of B, and so on. I'm not sure if this is by design or just corruption. This causes an endless loop in the getAncestors() function in the TWikiHierarchy class. If you can find the pages with the issue and manually fix the wiki source, that's good and you can likely figure out where the page should live. If not, you'll have to protect by modifying the source by adding a check in the getAncestors() function.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,052 views 2 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you