On Wed, 17 Feb 2021 17:19:58 GMT, Alan Bateman <al...@openjdk.org> wrote:
> > Right, I'm not exactly sure why the more limited changes I attempted in > > [5f4e87f](https://github.com/openjdk/jdk/commit/5f4e87f50f49e64b8616063c176ea35632b0347e) > > failed. In that change I simply changed the initialization order, which > > made the failing (closed) tests pass locally - but not in our CI. Since > > this is in initPhase1 there should be no concurrency possible. > > The Reference Handler thread is started by the initializer in > jl.ref.Reference so could be a candidate. The Finalizer thread is another but > this should VM.awaitInitLevel(1) and not touch JLA until initPhase1 is done. Turns out the native code called by `SystemProps.initProperties();` can initialize a `CharsetDecoder` if `sun.jnu.encoding` is set to certain values, and this tripped up the initialization to cause `getJavaLangAccess` to be called before `setJavaLangAccess`. By moving `setJavaLangAccess` to the very start of `initPhase1` we avoid this possibility, and limit churn. ------------- PR: https://git.openjdk.java.net/jdk/pull/2574