JDK-8340238 : C2 Compiler gets stuck at 100% CPU all the time
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8u421
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2024-09-11
  • Updated: 2025-06-10
  • Resolved: 2025-06-10
Related Reports
Duplicate :  
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
jvm_args: -Dlog4j.configurationFile=/usr/local/conf/log4j.xml -DLogXML=/usr/local/conf/log4j.xml -D_USE_DB_TRACE=yes -Djava.library.path=/usr/local/cm/lib64 -XX:+UnlockDiagnosticVMOptions -XX:+PrintCompilation -XX:+LogCompilation -XX:LogFile=/tmp/compilation.log -Xmx512m 

OS:AlmaLinux release 8.9 (Midnight Oncilla)

uname:Linux 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
libc:glibc 2.28 NPTL 2.28 
rlimit: STACK 8192k, CORE infinity, NPROC 54786, NOFILE 64000, AS 10000000k
load average:1.40 1.14 0.83

A DESCRIPTION OF THE PROBLEM :
we are using openjdk 1.8 

non -working version:- 

java-1.8.0-openjdk-devel-1.8.0.402.b06-2.el8.x86_64
java-1.8.0-openjdk-headless-1.8.0.402.b06-2.el8.x86_64
java-1.8.0-openjdk-1.8.0.402.b06-2.el8.x86_64

Working version :- 
java-1.8.0-openjdk-devel-1.8.0.362.b09-2.el8_7.x86_64
java-1.8.0-openjdk-headless-1.8.0.362.b09-2.el8_7.x86_64
java-1.8.0-openjdk-1.8.0.362.b09-2.el8_7.x86_64


we have started facing one high CPU issue( randomly) where  JVM C2 compiler get stuck at processing something  all the time consuming around 100% CPU for that process for an indefinite period. Unless we restart the jvm instance CPU never comes down  and it always stays high with below Backtrace. 
 
[root@linuxbox log]# top -n 1 -H -p 403530
top - 21:14:59 up 21:57,  4 users,  load average: 1.15, 1.06, 0.77
Threads:  21 total,   1 running,  20 sleeping,   0 stopped,   0 zombie
%Cpu(s): 50.0 us,  3.3 sy,  0.0 ni, 46.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  11717.7 total,    237.2 free,   5667.4 used,   5813.1 buff/cache
MiB Swap:   4000.0 total,   2477.0 free,   1523.0 used.   5275.6 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
403762 certbase  20   0 3177624 208368  16496 R  93.3   1.7   1082:07 C2 CompilerThre
403530 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:02.78 Thread -- CN-In
403557 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.19 GC task thread#
403572 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.19 GC task thread#
403602 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:01.39 VM Thread
403618 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.00 Reference Handl
403630 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.01 Finalizer
403758 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.00 Signal Dispatch
403776 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:02.19 C1 CompilerThre
403834 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.00 Service Thread
403838 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:23.15 VM Periodic Tas
408405 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.05 Thread-1
408449 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.02 Thread-2
411653 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.36 BC FIPS Entropy
415319 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:12.02 Thread-4
415331 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:05.81 Thread-3
415343 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.05 ConnectionPoolC
415348 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.08 ConnectionClean
415691 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:02.13 IfxSqliConnectC
416517 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:06.35 Timer-0
436026 certbase  20   0 3177624 208368  16496 S   0.0   1.7   0:00.06 Thread-12 
 
when I connect the gdb to this particular process 403762 it clearly states me that it is stuck more kind of an indefinite loop .

(gdb) bt
#0 0x00007f16751f23ff in PhaseIterGVN::remove_globally_dead_node(Node*) () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#1 0x00007f16752fcf01 in PhaseIdealLoop::do_split_if(Node*) () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#2 0x00007f167509c13b in PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&) () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#3 0x00007f16750967d0 in PhaseIdealLoop::build_and_optimize(bool, bool) () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#4 0x00007f1674cd4672 in Compile::Optimize() () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#5 0x00007f1674cd642b in Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool) () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#6 0x00007f1674c27476 in C2Compiler::compile_method(ciEnv*, ciMethod*, int) () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#7 0x00007f1674cdf885 in CompileBroker::invoke_compiler_on_method(CompileTask*) () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#8 0x00007f1674ce1c68 in CompileBroker::compiler_thread_loop() () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#9 0x00007f16753803bc in JavaThread::thread_main_inner() () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#10 0x00007f1675380729 in JavaThread::run() () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#11 0x00007f16751a05a2 in java_start(Thread*) () from /usr/local/thirdparty/java/j2sdk/jre/lib/amd64/server/libjvm.so
#12 0x00007f16769fb1ca in start_thread () from /usr/lib64/libpthread.so.0
#13 0x00007f1675c958d3 in clone () from /usr/lib64/libc.so.6



REGRESSION : Last worked in version 8u421


FREQUENCY : always



Comments
JDK-8339909 is just a place holder, It is duplicate of JDK-8215757 and JDK-8219448. I am fixing the duplicate links. Thanks,
10-06-2025

JDK-8339909 is invisible. If no sensitive info, please open it.
10-06-2025

Possibly closed by the backport of https://bugs.openjdk.org/browse/JDK-8215757 and https://bugs.openjdk.org/browse/JDK-8219448
24-03-2025

THe investigation has been done on JDK-8339909, and I prefer to close as duplicate of JDK-8339909
24-03-2025

Reply from submitter ============== Looks like if i pass this -XX:-SplitIfBlocks JVM option issue is not getting hit. and as soon as i remove this JVM option issue gets hit. I have attached the logs for both with and without SplitIfBlocks options for you reference. Just getting curious what the rationale behind this JVM option disablement ? is there any known bug around this ?? Thanks, Madhan
17-09-2024

Mail to submitter ============ Hi Madhan, Could you test with the jvm-option -XX:-SplitIfBlocks and share us the behaviour. Thanks Raja
13-09-2024

Reply from submitter ================= Hi Raja , CPU was always HIGH and as i explained in the thread c2 compiler uses 99% CPU all the time until i restart the jvm process and it doesn't crash just the CPU This err log is something I have got when I force crashed the process when it was stuck on the high CPU state. I don't see the problem with java-1.8.0-openjdk-1.8.0.362.b09-2.el8_7.x86_64 version rpm and we started seeing the issue as soon as we upgraded to 402 . also we tried with 422 version as well , issue is seen there as well. we have our own application where it just opens a secure port and sits idle nothing else . After a while as and when C2 compiler gets kicked in and stays at 99% CPU by my process because of C2 as explained in the jira. Thanks, Madhan
13-09-2024

Mailed submitter ============= Hello, Regarding the issue reported C2 Compiler gets stuck at 100% CPU all the time with OpenJDK 1.8.0_402-b06 and below hotspot error log is attached. # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fea9667b48a, pid=552831, tid=0x00007fea96f54100 # # JRE version: OpenJDK Runtime Environment (8.0_402-b06) (build 1.8.0_402-b06) # Java VM: OpenJDK 64-Bit Server VM (25.402-b06 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libpthread.so.0+0xe48a] pthread_cond_wait+0x1fa # # Core dump written. Default location: //core or core.552831 # # If you would like to submit a bug report, please visit: # https://access.redhat.com/support/cases/ # Above hotspot error log doesn't indicate any issue with C2Compiler. When referred as "C2 Compiler gets stuck at 100% CPU all the time with OpenJDK 1.8.0_402-b06" hope there is HIGH CPU and does it crash. Please confirm? #Share steps to reproduce the issue. #Any changes made prior to the issue ? #Was the JDK upgraded ? #If yes share the earlier version of JDK with which there was no issue with C2Compiler? Thanks
12-09-2024