> The native code on macOS which initializes cached JNI refs is not thread safe.
> The fix is to use the macOS dispatch_once mechanism as a lock.
> The fix is essentially all in JNIUtilities.h. There's some refactoring of the 
> macros in there to make things a bit cleaner
> and DECLARE_*_ONLY macros are added which the non-local clients now use to 
> declare variables.
> 
> The problem can be demonstrated with multi-threaded initialisation, and using 
> -Xcheck:jni
> A case which reproduces "fairly often" has been added as a test.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Phil Race has updated the pull request incrementally with one additional commit 
since the last revision:

  8393035

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/33481/files
  - new: https://git.openjdk.org/jdk/pull/33481/files/63f7e45f..0c360c3a

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

  Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/33481.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/33481/head:pull/33481

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

Reply via email to