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

Anton Kozlov akozlov at openjdk.org
Thu Jun 29 16:16:36 UTC 2023


On Thu, 29 Jun 2023 12:47:21 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 is adjusted only if Java's PID is 1 that means Java is run in a container. To adjust PID manually for a checkpoint'ed process, `-XX:CRaCMinPid=<value>` option should be used along with `CRaCCheckpointTo`. Min `CRaCMinPid` value is 1, max `CRaCMinPid` value is `UINT_MAX`, but it is actually limited by OS's pid_max.
>> 
>> There are the following possible scenarios for CRaC running in a container:
>> 
>>     // getpid   CRaCMinPid  |   set_last_pid      fork
>>     // ------------------------------------------------
>>     //   1         -        |    yes (default)    yes
>>     //   1         1        |    no               yes
>>     //   1        >1        |    yes              yes
>>     //   >1        -        |    no               no
>>     //   >1      <=getpid   |    no               no
>>     //   >1       getpid<   |    yes              yes
>
> Roman Marchenko has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 22 additional commits since the last revision:
> 
>  - Merge branch 'openjdk:crac' into pid-adjustment
>  - Added test case
>  - Merge branch 'pid1-tests' into pid-adjustment
>  - Implemented running command in container directly
>  - Added  FIXME for further steps
>  - Fixing review comments
>  - Fixing review comments
>  - Revert "Now CracMinPid option must be set explicitly to adjust PID"
>    
>    This reverts commit b3d66800d6ea441fb86498fdbb229400747eb44f.
>  - Now CracMinPid option must be set explicitly to adjust PID
>  - Adapting tests
>  - ... and 12 more: https://git.openjdk.org/crac/compare/c47fe131...b164f67b

Code changes looks almost good, see the comment.

test/jdk/jdk/crac/ContainerPidAdjustmentTest.java line 81:

> 79: 
> 80:     @Override
> 81:     // FIXME: need to add a test for default values, for Java's PID==1.

Is it still valid?

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

PR Review: https://git.openjdk.org/crac/pull/86#pullrequestreview-1502920184
PR Review Comment: https://git.openjdk.org/crac/pull/86#discussion_r1246854792


More information about the crac-dev mailing list