[crac] RFR: Decouple JVM and CRIU

Dan Heidinga duke at openjdk.java.net
Thu Oct 28 14:52:08 UTC 2021

On Thu, 28 Oct 2021 09:12:39 GMT, Anton Kozlov <akozlov at localhost> wrote:

> CREngine option to specify a program to do checkpoint/restore.
> * `criuengine` to use CRIU as it was used before.
> * `pauseengine` that stores PID in a file and pauses JVM until `java -XX:CRaCRestoreFrom=` is called. This should allow external mechanisms that may operate on a process.
> * `simengine` is something that simulates restore immediately, with the same effect as `-XX:+CRAllowToSkipCheckpoint`. It is intended to be simplest example and could be a starting point to implement Checkpoint/Restore with e.g. the help of a VM/container/... in which JVM is running.

src/hotspot/os/linux/os_linux.cpp line 5793:

> 5791:   os::jvm_path(path, len);
> 5792:   // path is ".../lib/server/libjvm.so"
> 5793:   char *after_elem;

Not sure what the expectations are in openjdk for this but I've always preferred to see every variable be initialized at declaration:

  char *after_elem = NULL;

src/java.base/unix/native/pauseengine/pauseengine.c line 65:

> 63: 
> 64:     } else if (!strcmp(action, "restore")) {
> 65:         FILE *pidfile = fopen(pidpath, "r");

The `FILE*` is being leaked in both these blocks


PR: https://git.openjdk.java.net/crac/pull/3

More information about the crac-dev mailing list