Java 17 crash compiling Oracle JDBC driver code

Solution Unverified - Updated

Environment

  • Oracle Java 17
  • Red Hat OpenJDK 17

Issue

  • We are seeing recurring crashes in java compiler threads compiling oracle jdbc driver methods like oracle.net.resolver.AddrResolution::resolveAddrTree, oracle.net.resolver.AddrResolution::resolveTNSAddress or oracle.net.resolver.NavAddress::navigate:
# JRE version: OpenJDK Runtime Environment (Red_Hat-17.0.15.0.6-1) (17.0.15+6) (build 17.0.15+6-LTS)
# Java VM: OpenJDK 64-Bit Server VM (Red_Hat-17.0.15.0.6-1) (17.0.15+6-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xaca44d]  PhaseIdealLoop::identical_backtoback_ifs(Node*)+0x7d

---------------  T H R E A D  ---------------

Current thread (0x0000558733aaf9f0):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=1151372, stack(0x00007f98f38fe000,0x00007f98f39fe000)]


Current CompileTask:
C2:39135329 32558   !   4       oracle.net.resolver.AddrResolution::resolveAddrTree (232 bytes)

Stack: [0x00007f98f38fe000,0x00007f98f39fe000],  sp=0x00007f98f39f8a60,  free space=1002k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xaca44d]  PhaseIdealLoop::identical_backtoback_ifs(Node*)+0x7d
V  [libjvm.so+0xacbb63]  PhaseIdealLoop::split_if_with_blocks_post(Node*)+0x33
V  [libjvm.so+0xacc7f3]  PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x183
V  [libjvm.so+0xac477f]  PhaseIdealLoop::build_and_optimize()+0xfbf
V  [libjvm.so+0x5e2d98]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x188
V  [libjvm.so+0x5e0281]  Compile::Optimize()+0x3f1
V  [libjvm.so+0x5e24ec]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0x140c
V  [libjvm.so+0x51e119]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0xc9
V  [libjvm.so+0x5ec485]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xfe5
V  [libjvm.so+0x5ed318]  CompileBroker::compiler_thread_loop()+0x668
V  [libjvm.so+0xeaba48]  JavaThread::thread_main_inner()+0x178
V  [libjvm.so+0xeabb98]  JavaThread::run()+0x138
V  [libjvm.so+0xeaec9f]  Thread::call_run()+0x6f
V  [libjvm.so+0xc22bd3]  thread_native_entry(Thread*)+0xe3

Resolution

As a workaround, exclude problem oracle JDBC methods from compilation with the following added to your JVM options:

-XX:CompileCommand=exclude,oracle/net/resolver/AddrResolution,resolveTNSAddress
-XX:CompileCommand=exclude,oracle/net/resolver/AddrResolution,resolveAddrTree 
-XX:CompileCommand=exclude,oracle/net/resolver/NavAddress,navigate
-XX:CompileCommand=exclude,oracle/net/resolver/NavServiceAlias,navigate
-XX:CompileCommand=exclude,oracle/net/jdbc/TNSAddress/Address,toString

Updating to a later version of the OJDBC driver may resolve the issue: Content from github.com is not included.Content from github.com is not included.https://github.com/adoptium/adoptium-support/issues/1313#issuecomment-2994650828.

Root Cause

Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.