How to get Java stacks when JVM can't reach a safepoint

前端 未结 3 464
傲寒
傲寒 2020-12-24 14:41

We recently had a situation where one of our production JVMs would randomly freeze. The Java process was burning CPU, but all visible activity would cease: no log output, no

3条回答
  •  甜味超标
    2020-12-24 14:52

    Your problem interested me very much. You were right about JIT. First I tried to play with GC types, but this did not have any effect. Then I tried to disable JIT and everything worked fine:

    java -Djava.compiler=NONE Tests
    

    Then printed out JIT compilations:

    java -XX:+PrintCompilation Tests
    

    And noticed that problem starts after some compilations in BigInteger class, I tried to exclude methods one by one from compilation and finally found the cause:

    java -XX:CompileCommand=exclude,java/math/BigInteger,multiplyToLen -XX:+PrintCompilation Tests
    

    For large arrays this method could work long, and problem might really be in safepoints. For some reason they are not inserted, but should be even in compiled code. Looks like a bug. The next step should be to analyze assembly code, I did not do it yet.

提交回复
热议问题