RFR: 8253495: CDS generates non-deterministic output [v2]
Ioi Lam
iklam at openjdk.java.net
Wed Mar 9 07:36:02 UTC 2022
On Wed, 9 Mar 2022 07:04:56 GMT, David Holmes <dholmes at 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
More information about the build-dev
mailing list