RFR: 8349888: AOTMode=create crashes with EpsilonGC

Ioi Lam iklam at openjdk.org
Wed Feb 12 17:53:13 UTC 2025


On Wed, 12 Feb 2025 09:58:46 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Reliably reproduces in current mainline, see the bug for reproducer. I think we are crashing after feeding `nullptr` to `class_category_name`. That `nullptr` is from `ArchiveBuilder::current()->get_buffered_addr` of `HelloStream`, which is skipped, as per warning message right before the crash. 
> 
> So it looks like the fix is to check if we are dealing with class that is available in the buffer before reaching for its buffered address. @iklam, see if this is a right fix?
> 
> Additional testing:
>  - [x] Linux x86_64 server fastdebug, reproducer now passes
>  - [x] Linux x86_64 server fastdebug, `runtime/cds` passes

The proposed fix doesn't address the root cause -- when EpisonGC is used, `HelloStream$$Lambda` is archived:


$ java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -XX:AOTCache=app.aot -Xlog:cds+resolve=trace::none | grep Hello
Resolved class  [ 14] HelloStream -> java.util.List
Resolved class  [ 28] HelloStream -> java.util.stream.Stream
Resolved class  [ 36] HelloStream -> java.util.stream.Collectors
Resolved class  [ 45] HelloStream -> java.lang.String
Resolved class  [ 48] HelloStream -> java.lang.System
Resolved class  [ 54] HelloStream -> java.io.PrintStream
Resolved class  [ 65] HelloStream -> HelloStream
Resolved class  [ 85] HelloStream -> java.lang.invoke.LambdaMetafactory
Resolved invokeinterface [ 19] HelloStream -> java.util.List.stream:()Ljava/util/stream/Stream;
Resolved invokeinterface [ 27] HelloStream -> java.util.stream.Stream.filter:(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;
Resolved invokeinterface [ 41] HelloStream -> java.util.stream.Stream.collect:(Ljava/util/stream/Collector;)Ljava/lang/Object;
Resolved invokevirtual [ 53] HelloStream -> java.io.PrintStream.println:(Ljava/lang/String;)V
Resolved invokevirtual [ 61] HelloStream -> java.lang.String.contains:(Ljava/lang/CharSequence;)Z
Resolved indy   [ 23] HelloStream
Skipping HelloStream: Unsupported location
Hello
Archiving CP entries for HelloStream$$Lambda+0x80000000e
archived klass  CP entry [  2]: HelloStream$$Lambda+0x80000000e app => HelloStream$$Lambda+0x80000000e app
archived klass  CP entry [  6]: HelloStream$$Lambda+0x80000000e app => java/lang/Object boot
archived method CP entry [  8]: HelloStream$$Lambda+0x80000000e java/lang/Object.<init>:()V => java/lang/Object


vs when EpisonGC is not used -- `HelloStream$$Lambda` is not archived:


$ java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf -XX:+UnlockExperimentalVMOptions -XX:-UseEpsilonGC -XX:AOTCache=app.aot -Xlog:cds+resolve=trace::none | grep Hello
Resolved class  [ 14] HelloStream -> java.util.List
Resolved class  [ 28] HelloStream -> java.util.stream.Stream
Resolved class  [ 36] HelloStream -> java.util.stream.Collectors
Resolved class  [ 45] HelloStream -> java.lang.String
Resolved class  [ 48] HelloStream -> java.lang.System
Resolved class  [ 54] HelloStream -> java.io.PrintStream
Resolved class  [ 65] HelloStream -> HelloStream
Resolved class  [ 85] HelloStream -> java.lang.invoke.LambdaMetafactory
Resolved invokeinterface [ 19] HelloStream -> java.util.List.stream:()Ljava/util/stream/Stream;
Resolved invokeinterface [ 27] HelloStream -> java.util.stream.Stream.filter:(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;
Resolved invokeinterface [ 41] HelloStream -> java.util.stream.Stream.collect:(Ljava/util/stream/Collector;)Ljava/lang/Object;
Resolved invokevirtual [ 53] HelloStream -> java.io.PrintStream.println:(Ljava/lang/String;)V
Resolved invokevirtual [ 61] HelloStream -> java.lang.String.contains:(Ljava/lang/CharSequence;)Z
Resolved indy   [ 23] HelloStream
Skipping HelloStream: Unsupported location


I'll investigate more and come up with a better fix.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23581#issuecomment-2654450406


More information about the hotspot-runtime-dev mailing list