[crac] RFR: Provide arguments for restore [v3]

Dan Heidinga heidinga at openjdk.java.net
Fri Mar 4 15:39:41 UTC 2022


On Tue, 1 Mar 2022 12:13:26 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> This change adds a new API and implementation to receive a new set of command-line arguments in the restored Java instance. The supplied demo code shows a faster replacement for `javac`.
>> 
>> The current implementation obligates the first argument of the new set not to start with the dash, otherwise, the java launcher will interpret it as its own parameter. So the first argument should be a "verb" similar to the Main class.
>
> Anton Kozlov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Rename to newArguments, add javax.crac mirror

Is there a design doc that describes the intended behaviour and limitations of this approach?  I've read the description in the PR but there's more to call out about what options can reasonably change.  ie: jvm options are unlikely to be successfully changed while passing new application args may be OK (if the app is written to handle that)

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

> 5844: static int set_new_args(int id, const char *args) {
> 5845:     char shmpath[128];
> 5846:     snprintf(shmpath, sizeof(shmpath), "/crac_%d", id);

Should the return value be checked here?  Something like:

int written = snprintf(shmpath, sizeof(shmpath), "/crac_%d", id);
if ((written < 0) || (written >= sizeof(shmpath))) {
  return -1;
}

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

> 5860:             fprintf(stderr, "write shm truncated");
> 5861:         }
> 5862:         close(shmfd);

Should this close the file?  Given the data didn't write correctly I think we should `shm_unlink` the shared mapping so it gets released.

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

> 5934: 
> 5935:   if (0 < info.si_int) {
> 5936:     *argp = get_new_args(info.si_int);

Is `info.si_int` unique per restored process or will restoring the same image twice at the same time corrupt the shared memory?

Basically, is the `inso.si_int` unique enough to be the id for the `/crac_%d` file?

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

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


More information about the crac-dev mailing list