Unable to Save Page Due to 'java.lang.StackOverflowError'

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

Unable to save a page and the logs will show errors such as java.lang.reflect.InvocationTargetException. This is the root cause of the error:

1 2 3 4 5 6 7 8 9 Caused by: java.lang.StackOverflowError at java.util.regex.Pattern$Branch.match(Pattern.java:4530) at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570) at java.util.regex.Pattern$Loop.match(Pattern.java:4697) at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629) at java.util.regex.Pattern$Add.match(Pattern.java:5163) at java.util.regex.Pattern$Add.match(Pattern.java:5163) at java.util.regex.Pattern$Single.match(Pattern.java:3314) at java.util.regex.Pattern$Branch.match(Pattern.java:4530)

Cause

This error indicates that the current stack is too small to contain the number of methods being called by the one thread in confluence. Confluence uses a lot of indirection internally via Spring, thus the stack size often needs to be higher than it might be for other applications.

Resolution

There are two bugs related to Stack Overflows in Confluence:

Updated on April 7, 2025

Still need help?

The Atlassian Community is here for you.