Description
We've been seeing a high degree of segfaults recently in the processing
unit tests under JDK 21. Here's an example: https://github.com/apache/druid/actions/runs/11528594002/job/32166241444?pr=17414. The common thread is an error like this:
Current CompileTask:
C2:1780380 144967 4 org.apache.druid.query.filter.InDimFilter::optimizeLookup (744 bytes)
Stack: [0x00007f9c045fb000,0x00007f9c046fb000], sp=0x00007f9c046f6660, free space=1005k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xf15629] BoolNode::Ideal(PhaseGVN*, bool)+0x19
V [libjvm.so+0xd6258e] PhaseIterGVN::transform_old(Node*)+0x9e
V [libjvm.so+0x6ba360] Conv2BNode::Ideal(PhaseGVN*, bool)+0x180
V [libjvm.so+0xd6258e] PhaseIterGVN::transform_old(Node*)+0x9e
V [libjvm.so+0xd5e4a9] PhaseIterGVN::optimize()+0xf9
V [libjvm.so+0x6712cf] Compile::Optimize()+0xf9f
V [libjvm.so+0x672a06] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0xf26
V [libjvm.so+0x598acb] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x18b
V [libjvm.so+0x678ee4] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xca4
V [libjvm.so+0x67c0d8] CompileBroker::compiler_thread_loop()+0x6a8
V [libjvm.so+0x931f40] JavaThread::thread_main_inner()+0x1e0
V [libjvm.so+0xf86b88] Thread::call_run()+0xa8
V [libjvm.so+0xd103ba] thread_native_entry(Thread*)+0xda
Things that did not help include:
- Using Corretto instead of Zulu (Swap Zulu for Corretto. #17426)
- Switching off
jfr_profiler
(Use jfr-profiler for JDK 17 tests only. #17418). - Updating various test/build dependencies (Update errorprone, mockito, jacoco, checkerframework. #17414).
Since this is in the C2 compiler, and only happens on JDK 21, it seems likely to be a JDK bug rather than something we're doing wrong.
@pranavbhole has raised a support case with Azul at https://support.azul.com/hc/en-us/requests/65354. We don't have any special support contract with them, so hopefully they respond out of the goodness of their hearts. Since this issue happens on Corretto too, it's possibly a broader OpenJDK issue, so we could also consider raising a bug with OpenJDK.