[crac] RFR: PID adjustment on checkpoint [v3]

Radim Vansa rvansa at openjdk.org
Wed Jun 21 14:20:36 UTC 2023

On Wed, 21 Jun 2023 13:43:49 GMT, Roman Marchenko <rmarchenko at openjdk.org> wrote:

>> src/java.base/share/native/launcher/main.c line 328:
>>> 326:         const char *env_min_pid_str = getenv("CRAC_MIN_PID");
>>> 327:         const int env_min_pid = env_min_pid_str ? atoi(env_min_pid_str) : 0;
>>> 328:         // TODO: should it be checked for max pid overflow?
>> I don't quite follow max_pid problem. Could you elaborate? As for me, I don't see the need for max pid check
> As far as I understand the max PID is not INT_MAX, it is 2^22. In case of CRAC_MIN_PID is greater than 2^22, we'd have a possible infinite loop while spinning the last PID.

I wouldn't test what's in `/proc/sys/kernel/pid_max` explicitly, but if PID #N+1 is lower than PID #N we have probably overflowed and that's what we should detect, and fail gracefully.


PR Review Comment: https://git.openjdk.org/crac/pull/86#discussion_r1237083787

More information about the crac-dev mailing list