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

Anton Kozlov akozlov at openjdk.org
Wed Jun 21 13:31:39 UTC 2023


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

>> src/java.base/share/native/launcher/main.c line 326:
>> 
>>> 324:     if (is_checkpoint) {
>>> 325:         const int crac_min_pid_default = 128;
>>> 326:         const char *env_min_pid_str = getenv("CRAC_MIN_PID");
>> 
>> Why using an environment variable rather than JVM option? Env vars cannot be 'listed', so the user can't know about them without finding a specific place in documentation.
>
> This is because of PID adjustment  happens before JVM inits, so to use JVM option we need to have JVM option parsing implemented in main.c (at least for one option), more complicated than it was done in parse_checkpoint(). That is why I've decided to use env var instead. ~~OTOH maybe it worth considering moving PID adjustment & forking implementation to java.c, closer to JVM_Init call.~~ But no, option parsing is performed in JavaMain, running in a separate thread. This is not convenient for fork'ing.

I would prefer -XX option as well. E.g. -XX:NativeMemoryTracking= is also handled in the launcher. Although in this case the option won't be handled in JVM at all, I think providing a common interface is better, since the option is expected to be changed in some product use-cases.

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

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


More information about the crac-dev mailing list