Unable to Save Page Due to 'java.lang.StackOverflowError'
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:
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: