NullPointerException stack trace not available without debug agent

前端 未结 3 503
北荒
北荒 2020-11-29 20:46

I have recently found a bug that causes a NullPointerException. The exception is caught and logged using a standard slf4j statement. Abridged code below:

for         


        
3条回答
  •  臣服心动
    2020-11-29 21:39

    Is it possible that this code is in an inner loop? Then then JIT compiler might be compiling the call stack for this to native code, losing the stack information. Then when you attach the debugger it disables the JIT, making the information available again.

    The other manual exceptions keep displaying the information as the JIT is not optimising.

    It looks like this can sometimes happen for others from a comment in this class source code at line 102:

    http://logging.apache.org/log4j/1.2/xref/org/apache/log4j/spi/LocationInfo.html

提交回复
热议问题