On Wed, 9 Mar 2022 07:04:56 GMT, David Holmes <dhol...@openjdk.org> wrote:

> I have reservations about contorting things this way just to get 
> "deterministic output".
> 
> The VM needs to fully initialize and then become quiescent before the dump 
> occurs, and as I say below if you don't start other threads then you 
> potentially remove part of the archive because classes won't be loaded by 
> those threads.
> 
> I think if you care about the order of dumping classes then you should 
> control that order, you don't try to force the order of loading. Can't you 
> sort things before dumping? ie rehash/rebuild the hashtables etc so it has a 
> canonical ordering? I see this was mentioned in the bug report and is 
> considered a largish/complex fix, but it would be the proper fix IMO.
> 
> Thanks, David

I tried the "proper" approach but it's very complicated. I already have an 
implementation that sorts all the metadata. However, the CDS archive also 
contains a heap dump, which includes Java HashMaps. If I allow those 3 Java 
threads to start, some HashMaps in the module graph will have unstable 
ordering. I think the reason is concurrent thread execution causes unstable 
assignment of the identity_hash for objects in the heap dump. I cannot think of 
a clean way to fix this.

The alternative, disabling Java thread starts, is much simpler and much more 
appealing to me.

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

PR: https://git.openjdk.java.net/jdk/pull/7748

Reply via email to