C2 Compiler SIGSEGV in final_graph_reshaping_walk when compiling retryRelease0

XMLWordPrintable

    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      JVM Version: OpenJDK 64-Bit Server VM Zulu25.30+17-CA (25.0.1+8-LTS, mixed mode, tiered, compressed class ptrs, z gc, linux-amd64)
      Release: 25.0.1+8-LTS
      Vendor: Azul Zulu

      Relevant JVM Flags at time of crash:
      UseCompressedClassPointers = true (default)
      UseCompressedOops = false (ergonomic, automatically disabled by ZGC)
      UseZGC = true (command line)

      A DESCRIPTION OF THE PROBLEM :
      The JVM crashes with SIGSEGV during C2 compilation of io.netty.util.internal.ReferenceCountUpdater::retryRelease0.

      SIGSEGV happens @ V [libjvm.so+0x71dcce] Compile::final_graph_reshaping_walk(Node_Stack&, Node*, Final_Reshape_Counts&, Unique_Node_List&)+0x32e

      with the current compile task being:

      C2:155656695 22347 4 io.netty.util.internal.ReferenceCountUpdater::retryRelease0 (70 bytes)

      JVM: OpenJDK 64-Bit Server VM Zulu25.30+17-CA (25.0.1+8-LTS)

      JVM CONFIGURATION FOR THIS CRASH:
      - GC: ZGC (-XX:+UseZGC) -- though note that this is not specific to ZGC, as we've seen this same crash with G1GC as well.
      - UseCompressedClassPointers = true (default)
      - UseCompressedOops = false (ergonomic, automatically disabled by ZGC)

      REPRODUCIBILITY:
      - Occurs reliably across multiple production services with Java 25.0.1
      - Time to reproduction varies by service: observed from less than an hour to ~1.5 days
      - Consistently crashes when compiling the same method: io.netty.util.internal.ReferenceCountUpdater::retryRelease0
      - Observed with both ZGC and G1GC garbage collectors
      - Does NOT occur on Java 21 with identical application code and configuration
      - Occurs across multiple pods/instances in production

      NOTE: This crash may be related to JDK-8361211 which mentions issues with abstract classes during C2 compilation.

      workaround:
      Excluding the method from C2 compilation works as a workaround seemingly:
      -XX:CompileCommand=exclude,io/netty/util/internal/ReferenceCountUpdater.retryRelease0

      We attempted a workaround by disabling both compressed class ptrs & compressed oops (already disabled for ZGC) -- but this ended up hitting another crash in a different spot (Matcher::xform) while compiling the same method (I will file a separate issue for that).

      The CompileCommand=exclude workaround is the only fully effective solution we have found.

      Reverting to Java 21 also avoids the issue.

      REGRESSION : Last worked in version 21

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Use Java 25.0.1 (we use Zulu25.30+17-CA but I suspect it might be reproducible on other builds of OpenJDK too)
      2. Configure JVM with ZGC (-XX:+UseZGC)
      3. Use default JVM settings (UseCompressedClassPointers will be enabled by default)
      4. Include Netty networking library in application (io.netty:netty-all:4.2.7.Final version)
      5. Run application with network I/O workload that exercises Netty's reference counting mechanisms
      6. Wait for C2 compiler to attempt problematic compilation of io.netty.util.internal.ReferenceCountUpdater::retryRelease0
      7. Crash occurs after service runtime varying from less than an hour to days depending on service

      I've provided the replay log in confidential data so that may be an easier way to reproduce.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No crash
      ACTUAL -
      Crash

      ---------- BEGIN SOURCE ----------
      The crash occurs when compiling a method from the public Netty library:

      Library: io.netty:netty-all:4.2.7.Final (includes netty-common where this class resides)
      Class: io.netty.util.internal.ReferenceCountUpdater (abstract class)
      Method: retryRelease0 (private method, 70 bytes of bytecode)


      ---------- END SOURCE ----------

            Assignee:
            Unassigned
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: