gc/shenandoah/compiler/TestReferenceCAS.java failed with -Xcomp

Leslie Zhai zhaixiang at loongson.cn
Mon Apr 24 08:44:25 UTC 2023


Hi,

Sun yaqi, my colleague, reported gc/shenandoah/compiler/TestReferenceCAS.java failed with -Xcomp[1] for x86_64, aarch64 and LoongArch64.
And I just changed[2] `shenandoah_assert_not_in_cset_if` condition:

```
 template <typename T>
 inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_common(T* addr, oop value) {
   shenandoah_assert_marked_if(nullptr, value, !CompressedOops::is_null(value) && ShenandoahHeap::heap()->is_evacuation_in_progress());
-  shenandoah_assert_not_in_cset_if(addr, value, value != nullptr && !ShenandoahHeap::heap()->cancelled_gc());
+  shenandoah_assert_not_in_cset_if(addr, value, value != nullptr && !ShenandoahHeap::heap()->cancelled_gc() && strcmp(ShenandoahGCHeuristics, "aggressive"));
   ShenandoahBarrierSet* const bs = ShenandoahBarrierSet::barrier_set();
   bs->iu_barrier(value);
   bs->satb_barrier<decorators>(addr);
```
But what is the root cause about `aggressive` ShenandoahGCHeuristics fail to work?


1.
STDOUT:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/mnt/repo/openjdk/jdk/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp:246), pid=760863, tid=761352
#  Error: Shenandoah assert_not_in_cset failed; Object should not be in collection set

Referenced from:
  interior location: 0x00007f2a28b000c8
  inside Java heap
    not in collection set
  region: |    1|R  |BTE 7f2a28b00000, 7f2a28b7ff20, 7f2a28b80000|TAMS 7f2a28b00000|UWM 7f2a28b00000|U   511K|T   511K|G     0B|S     0B|L     0B|CP   0

Object:
  0x00007f2a7bf05100 - klass 0x0000000800006340 java.security.CodeSource
    not allocated after mark start
    not after update watermark
        marked strong
    not marked weak
        in collection set
  mark: marked(0x00007f2a7bf838d3)
  region: | 2665|CS |BTE 7f2a7bf00000, 7f2a7bf80000, 7f2a7bf80000|TAMS 7f2a7bf80000|UWM 7f2a7bf80000|U   512K|T     0B|G   511K|S   184B|L   415K|CP   0

Forwardee:
  0x00007f2a7bf838d0 - klass 0x0000000800006340 java.security.CodeSource
        allocated after mark start
    not after update watermark
        marked strong
        marked weak
    not in collection set
  mark: mark(is_neutral no_hash age=0)
  region: | 2666|R  |BTE 7f2a7bf80000, 7f2a7bfa0cc8, 7f2a7c000000|TAMS 7f2a7bf80000|UWM 7f2a7bfa0cc8|U   131K|T     0B|G   131K|S   184B|L     0B|CP   0


#
# JRE version: OpenJDK Runtime Environment (21.0) (fastdebug build 21-internal-adhoc.loongson.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 21-internal-adhoc.loongson.jdk, compiled mode, sharing, tiered, compressed class ptrs, shenandoah gc, linux-amd64)
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/scratch/1/core.760863)
#
# An error report file with more information is saved as:
# /mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/scratch/1/hs_err_pid760863.log
[22.784s][warning][os] Loading hsdis library failed
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
STDERR:
rerun:
cd /mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/scratch/1 && \
HOME=/home/loongson \
LANG=zh_CN.UTF-8 \
LC_ALL=C \
PATH=/bin:/usr/bin:/usr/sbin \
TEST_IMAGE_DIR=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/images/test \
_JVM_DWARF_PATH=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/images/symbols \
CLASSPATH=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/classes/1/gc/shenandoah/compiler/TestReferenceCAS_no-coops.d:/mnt/repo/openjdk/jdk/test/hotspot/jtreg/gc/shenandoah/compiler:/mnt/download/jtreg/lib/javatest.jar:/mnt/download/jtreg/lib/jtreg.jar \
    /mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/images/jdk/bin/java \
        -Dtest.vm.opts='-XX:MaxRAMPercentage=4.16667 -Dtest.boot.jdk=/mnt/download/jdk-20.0.1 -Djava.io.tmpdir=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/tmp' \
        -Dtest.tool.vm.opts='-J-XX:MaxRAMPercentage=4.16667 -J-Dtest.boot.jdk=/mnt/download/jdk-20.0.1 -J-Djava.io.tmpdir=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/tmp' \
        -Dtest.compiler.opts= \
        -Dtest.java.opts= \
        -Dtest.jdk=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/images/jdk \
        -Dcompile.jdk=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/images/jdk \
        -Dtest.timeout.factor=4.0 \
        -Dtest.nativepath=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/images/test/hotspot/jtreg/native \
        -Dtest.root=/mnt/repo/openjdk/jdk/test/hotspot/jtreg \
        -Dtest.name=gc/shenandoah/compiler/TestReferenceCAS.java#no-coops \
        -Dtest.file=/mnt/repo/openjdk/jdk/test/hotspot/jtreg/gc/shenandoah/compiler/TestReferenceCAS.java \
        -Dtest.src=/mnt/repo/openjdk/jdk/test/hotspot/jtreg/gc/shenandoah/compiler \
        -Dtest.src.path=/mnt/repo/openjdk/jdk/test/hotspot/jtreg/gc/shenandoah/compiler \
        -Dtest.classes=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/classes/1/gc/shenandoah/compiler/TestReferenceCAS_no-coops.d \
        -Dtest.class.path=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/classes/1/gc/shenandoah/compiler/TestReferenceCAS_no-coops.d \
        -Dtest.class.path.prefix=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/classes/1/gc/shenandoah/compiler/TestReferenceCAS_no-coops.d:/mnt/repo/openjdk/jdk/test/hotspot/jtreg/gc/shenandoah/compiler \
        -Dtest.modules=java.base/jdk.internal.misc:+open \
        --add-modules java.base \
        --add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
        --add-opens java.base/jdk.internal.misc=ALL-UNNAMED \
        -XX:MaxRAMPercentage=4.16667 \
        -Dtest.boot.jdk=/mnt/download/jdk-20.0.1 \
        -Djava.io.tmpdir=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/tmp \
        -Djava.library.path=/mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/images/test/hotspot/jtreg/native \
        -Diters=20000 \
        -XX:+UnlockDiagnosticVMOptions \
        -XX:+UnlockExperimentalVMOptions \
        -XX:ShenandoahGCHeuristics=aggressive \
        -XX:+UseShenandoahGC \
        -XX:-UseCompressedOops \
        -Xcomp \
        com.sun.javatest.regtest.agent.MainWrapper /mnt/repo/openjdk/jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_hotspot_jtreg_gc_shenandoah_compiler_TestReferenceCAS_java/gc/shenandoah/compiler/TestReferenceCAS_no-coops.d/main.1.jta

TEST RESULT: Failed. Unexpected exit from test [exit code: 134]


2. https://github.com/xiangzhai/jdk/commit/37ab11ed23fe45c9411d87cb3a74e9fcedc1accc 


Thanks,
Leslie Zhai


More information about the shenandoah-dev mailing list