On Wed, 11 Feb 2026 20:28:15 GMT, Ioi Lam <[email protected]> wrote:

> We are seeing intermittent failures (12 times in Jan 2026) where the CDS 
> archives generated in the JDK build is not deterministic.
> 
> The symptom is that (perhaps due to the peculiarity of hash codes and memory 
> addressing??) the constant pool entry for `ReferenceKey<?>` in the 
> `WeakReferenceKey` class is not resolved when the failure happens.
> 
> The fix is for the JVM to call a method in `WeakReferenceKey` to force this 
> entry to be resolved.

> I think a better approach might be in ReferencedKeyMap.prepareForAOTCache, 
> after
> 
> ```
>         for (ReferenceKey<K> key : map.keySet()) {
>             Object referent = key.get();
> ```
> 
> inject a call `key.equals(new StrongReferenceKey(referent))`, so that we hit 
> the instanceof. What do you think? This code should be less reliant to weird 
> translation hacks and requires less VM hacks.

> A better approach might be as simple as calling `MethodType.methodType()` to 
> retrieve an existing method type, maybe `MethodType.methodType(void.class)` 
> would be sufficient, in `MethodType::assemblySetup`.

`ReferencedKeyMap.prepareForAOTCache()` is only called only when 
`AOTClassLinking` is true. However, when creating the default CDS archives, 
`AOTClassLinking` is false.

Also, I am not sure if we should insert unnecessary code to try to achieve some 
unobvious side effect.

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

PR Comment: https://git.openjdk.org/jdk/pull/29678#issuecomment-3888436219

Reply via email to