[crac] RFR: 8372933: [CRaC] Restore failed due to incompatible or missing CPU features, try using -XX:CPUFeatures=0xfoo, 0xbar on checkpoint [v6]
Radim Vansa
rvansa at openjdk.org
Tue Feb 3 09:45:28 UTC 2026
On Mon, 2 Feb 2026 20:28:07 GMT, Jan Kratochvil <jkratochvil at openjdk.org> wrote:
>> src/hotspot/share/include/crlib/crlib_image_constraints.h line 68:
>>
>>> 66:
>>> 67: // For failed require_bitmap it will copy value from the image to the provided buffer.
>>> 68: bool (*get_failed_bitmap)(crlib_conf_t *, const char *name, unsigned char *value_return, size_t value_size);
>>
>> From this API, I don't see how you'd get to know the size of the stored value. Could you either report that as the return value (`-1` => error retrieving, `0` => bitmap missing or empty)?
>> Alternatively `value_size` could be an in-out argument. (the former would be inline with `crlib_restore_data::get_restore_data`, the latter is used in `crlib_user_data::lookup_user_data`)
>> And add a comment describing the return value/parameter.
>
> Currently, if the size does not match, it always fails:
>
> if (value_return) {
> if (!c.image_data || value_size != c.data_size) {
> result = false;
>
> This means that the version of OpenJDK used for restoring is different from the one used for snapshotting, which will result in:
>
> log_error(crac)("Restore failed due to incompatible or missing CPU features, try using -XX:CPUFeatures=%s on checkpoint.", image_features.print_numbers());
> } else {
> --> log_error(crac)("Restore failed due to incompatible or missing CPU features.");
>
> It would be possible, but difficult, to print the CPU features if their size differs from `sizeof(VM_Version::VM_Features)`. I don't think we need to support running mismatched OpenJDK versions extensively.
I see, so you just assume that the user will guess the right size, or get an error. I am not saying that you should print a partial bitmap; I think that
if (api->get_failed_bitmap(..., sizeof(image_features)) != sizeof(image_features)) {
// error
}
would be an OK implementation. Just worried about cementing a limitation into the API.
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/278#discussion_r2758172193
More information about the crac-dev
mailing list