Best way on how to solve/debug JVM crash (SIGSEGV)

前端 未结 3 1112
别跟我提以往
别跟我提以往 2021-02-06 00:26

I\'m really lost and I don\'t know how to face and solve my problem. I have a piece of simple Java Code, which leads to a JVM crash:

#
# A fatal error has been d         


        
3条回答
  •  梦谈多话
    2021-02-06 00:52

    The crash report tells the error has happened in JIT compiler thread:

    Current thread (0x00007f89e481c800):  JavaThread "C2 CompilerThread1"
    

    Take the following steps do diagnose compiler problems:

    1. Try the most recent JVM build available in JDK 9 EA: https://jdk9.java.net/download/

      If the problem disappears, you can either stay with this version or try to locate the exact commit that solves the issue and then backport it to JDK 8. How to backport fixes and how to build HotSpot yourself - it's a separate topic, but I can tell if you're interested.

    2. If the problem persists, try to find a problematic method and exclude it from compilation.

      Current CompileTask: C2: 114667 5303 4 com.sosse.time.timeseries.gson.TypeConverterHelper::deserialize (157 bytes)
      

      Looks like in your case it fails compiling TypeConverterHelper.deserialize(). Add the following JVM option to exclude this particular method:

      -XX:CompileCommand=exclude,com.sosse.time.timeseries.gson.TypeConverterHelper::deserialize
      
    3. If it does not help, try to exclude more methods by providing multiple -XX:CompileCommand. To find candidates to exclude use -XX:+PrintCompilation and look at the bottom of the printed list. You can also exclude the whole classes and packages from compilation, e.g.

      -XX:CompileCommand=exclude,com.sosse.time.timeseries.gson.*::*
      
    4. Try to disable certain compiler optimizations one by one. Some options to try are:

      -XX:-DoEscapeAnalysis
      -XX:LoopUnrollLimit=0
      -XX:-PartialPeelLoop
      -XX:-UseLoopPredicate
      -XX:-LoopUnswitching
      -XX:-ReassociateInvariants
      -XX:MaxInlineLevel=1
      -XX:-IncrementalInline
      -XX:-RangeCheckElimination
      -XX:-EliminateAllocations
      -XX:-UseTypeProfile
      -XX:AliasLevel=0
      
    5. Whether the problematic method/optimization is found or not, run JVM again with

      -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation
      

      This will create hotspot_pid1234.log file in the current directory with detailed compilation log.

    6. Submit the bug report at bugreport.java.com. Select

      Product/Category: HotSpot Virtual Machine (errors)
      Subcategory:      J2SE Server Compiler
      

      Make sure to include full hs_err_pid.log and hotspot_pid.log from step 5. It would be very helpful if you could provide a reduced self-contained example that demonstrates the problem.

      For a faster reaction you may also post a message to hotspot-compiler-dev mailing list.

提交回复
热议问题