Honestly, I don’t believe your StackOverflowError is caused by cookies—especially since it happens sporadically and is “fixed” by a reboot. It’s far more likely that the JVM simply doesn’t have enough stack space. I’d start by increasing the thread stack size with the -Xss
option, or even try a different JVM distribution
.
It’s also possible that you have excessively deep call chains—either through recursion or deeply nested method calls—that exhaust the stack. I recommend reviewing your code for any deep recursion
or long chains of method invocations
and refactoring them (for example, converting recursive algorithms to iterative ones) to prevent the error.