[crac] RFR: 8370888: [CRaC] Use better source of random for UUID generation in checkpoint path

Timofei Pushkin tpushkin at openjdk.org
Thu Oct 30 14:38:31 UTC 2025


On Thu, 30 Oct 2025 14:13:45 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> src/hotspot/os/posix/crac_posix.cpp line 63:
>> 
>>> 61:   for (size_t i = 0; i < length; i += sizeof(int)) {
>>> 62:     int value = os::next_random(seed);
>>> 63:     seed = value;
>> 
>> Is there a reason not to use `os::init_random` and `os::random`? It would be just a bit simpler.
>
> I am not sure why `os::init_random` is not called anywhere AFAICT, but initializing it randomly (with time) could be intrusive; it can be intentionally deterministic based on the seed.

I was looking at JDK 17 sources accidentally, there it is called in a few places, seemingly with no relations between them. I guess  it's OK since this is random anyway... Ok, let's leave it as is.

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

PR Review Comment: https://git.openjdk.org/crac/pull/271#discussion_r2478353978


More information about the crac-dev mailing list