RFR: 8350649: Class unloading accesses/resurrects dead Java mirror after JDK-8346567 [v2]

Aleksey Shipilev shade at openjdk.org
Tue Feb 25 20:06:32 UTC 2025


> See bug for description of the bug. Shenandoah seems to be the only GC that runs into this problem so far.
> 
> Before [JDK-8346567](https://bugs.openjdk.org/browse/JDK-8346567), we pulled class modifiers from the native `Klass*`, and so we bypassed this trouble. But now we take modifiers out of Java mirror, and this happens during unloading, which accesses/resurrects potentially dead mirror.
> 
> I think the solution is to keep storing a cached modifiers field in `Klass` instead of relying on Java mirror being accessible. Unfortunately, this patch undoes the removal of `u2` field from `Klass` done in [JDK-8346567](https://bugs.openjdk.org/browse/JDK-8346567).
> 
> Additional testing:
>  - [x] Linux x86_64 server fastdebug, original reproducer now passes
>  - [x] Linux x86_64 server fastdebug, `hotspot_gc_shenandoah`
>  - [x] Linux x86_64 server fastdebug, `jdk_jfr`
>  - [x] Linux x86_64 server fastdebug, `jdk_jfr` with `-XX:+UseShenandoahGC` now passes

Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:

  Alternate fix: compute modifiers directly

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/23775/files
  - new: https://git.openjdk.org/jdk/pull/23775/files/7269b441..c302a4a2

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23775&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23775&range=00-01

  Stats: 22 lines in 4 files changed: 3 ins; 14 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/23775.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23775/head:pull/23775

PR: https://git.openjdk.org/jdk/pull/23775


More information about the hotspot-dev mailing list