生产环境出现异常堆栈丢失,但本地直接看又没有丢失情况
目前遇到的场景是由于jvm对堆栈做了优化,在遇到大量重复错,忽略全部打印
参考java更新日志
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
https://www.oracle.com/technetwork/java/javase/relnotes-139183.html
遇到类似问题处理方法:
1,找到最早的错误日志,一般有几千个错误到几万错误会打印完整日志
这个jvm原生不支持动态配置,据说有些厂自己支持了,目前没有考虑动态支持和禁用这块配置,但不影响问题排查