Exception stack trace suppressed after same exception many times + Java

31 views 12:26 am 0 Comments August 27, 2018

Sometimes, we have seen in logs same exception occurs continuously and you get full stacktrace of that exception. But after some time, you just get only exception message not full stack trace. The reason for this is below from java doc.

 

The compiler in the server VM now provides correct stack backtraces for all “cold” built-in exceptions. For performance purposes, when such an exception is thrown a few times, the method may be recompiled. After recompilation, the compiler may choose a faster tactic using preallocated exceptions that do not provide a stack trace. To disable completely the use of preallocated exceptions, use this new flag: -XX:-OmitStackTraceInFastThrow

Leave a Reply

Your email address will not be published. Required fields are marked *