[crac] RFR: 8367975: [CRaC] Pattern in CRaCCheckpointTo

Radim Vansa rvansa at openjdk.org
Tue Sep 23 12:34:17 UTC 2025


On Tue, 23 Sep 2025 08:17:06 GMT, Timofei Pushkin <tpushkin at openjdk.org> wrote:

>> Add support for pattern in `CRaCCheckpointTo` VM option.
>
> src/hotspot/share/runtime/crac.cpp line 208:
> 
>> 206:           check_retval(snprintf(buf, buflen, "%08x-%04x-4%03x-a%03x-%04x%08x",
>> 207:             static_cast<u4>(os::random()), time_mid_high >> 16, time_mid_high & 0xFFF,
>> 208:             seq_and_node_low & 0xFFF, seq_and_node_low >> 16, static_cast<u4>(os::random())));
> 
> Not that it matters much, but I believe the 4th part does not always have to start with "a" according to the spec
> 
> Suggestion:
> 
>           check_retval(snprintf(buf, buflen, "%08x-%04x-4%03x-%04x-%04x%08x",
>             static_cast<u4>(os::random()), time_mid_high >> 16, time_mid_high & 0xFFF,
>             (seq_and_node_low & 0x3FFF | 0x8000), seq_and_node_low >> 16, static_cast<u4>(os::random())));

We're using RFC 4122 variant, with Msb0 = 1 and Msb1 = 0: https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.1

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

PR Review Comment: https://git.openjdk.org/crac/pull/264#discussion_r2372162682


More information about the crac-dev mailing list