LaVOZs

The World’s Largest Online Community for Developers

'; java - Show entire stack trace even in a stack overflow error - LavOzs.Com

By default, when a Java program (in this case I'm just talking about a simple commandline program, no extra frameworks or anything) crashes, the exception prints a stack trace, which is helpful.

However, in the case of a stack overflow error, it seems the depth goes over some arbitrary limit, because the trace gets cut off; the upshot is that I only get to see the (long list of repeats of) the code that fell into the infinite recursion, and not the calling code that set up the conditions for it, which is what I need to track down the bug I am currently looking at.

Is there a way to tell the JVM 'print the entire stack trace, I don't care how long it is'?

Run java -XX:MaxJavaStackTraceDepth=999999

The default limit is 1024.

Related
Showing the stack trace from a running Python application
How can I get a JavaScript stack trace when I throw an exception?
How can I get the current stack trace in Java?
How can I convert a stack trace to a string?
How to print a stack trace in Node.js?
What is a stack trace, and how can I use it to debug my application errors?
Get exception description and stack trace which caused an exception, all as a string
How can I prevent emacs from cutting off stack traces in batch mode?
java.lang.reflect.Proxy: Huge exception stack trace