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

Anton Kozlov akozlov at openjdk.org
Fri Jun 23 15:58:35 UTC 2023

On Fri, 23 Jun 2023 13:03:47 GMT, Roman Marchenko <rmarchenko at openjdk.org> wrote:

>> On restore, there might be PID value conflicts because of small PID values, if it was checkpoint'ed in a container. Therefore, when checkpointing in a container, we need to move PID value for new processes to a particular value to avoid conflicts on restore.
>> See https://github.com/CRaC/example-lambda/blob/master/checkpoint.cmd.sh#L8 for example.
>> This PR contains implemented functionality similar to the example above, making this work out of the box. By default, if checkpointing, PID value for new processes starts from 128. 
>> To set a custom value, `CRAC_MIN_PID` environment variable should be used. 
>> Min `CRAC_MIN_PID` value is 1, max `CRAC_MIN_PID` is not implemented currently.
> Roman Marchenko has updated the pull request incrementally with five additional commits since the last revision:
>  - Implemented vm option instead of env var
>  - Added test for the last pid overflow while spinning
>  - Re-worked spin_last_pid procedure
>  - Re-worked set_last_pid procedure
>  - Replacing fork() with clone() for Linux platform

src/hotspot/share/runtime/globals.hpp line 2100:

> 2098:       "Path to image for restore, replaces the initializing VM on success") \
> 2099:                                                                             \
> 2100:   product(ccstr, CRaCMinPid, NULL, RESTORE_SETTABLE,                        \

`product(int, CRaCMinPid, 128`?

Why is it RESTORE_SETTABLE, if the option is ignored on the restore (per the doc below)?

src/java.base/share/native/launcher/main.c line 199:

> 197:     int res = 0;
> 198:     if (0 > write(last_pid_file, buf, len)) {
> 199:         res =   errno;

Nit: Extra spaces `=   errno`


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

More information about the crac-dev mailing list