[crac] RFR: CRaC may exit before image dump is completed

Dan Heidinga heidinga at openjdk.org
Tue Feb 21 16:56:58 UTC 2023


On Tue, 21 Feb 2023 16:16:45 GMT, Roman Marchenko <rmarchenko at openjdk.org> wrote:

>> src/java.base/share/native/launcher/main.c line 236:
>> 
>>> 234: 
>>> 235:     if (is_checkpoint && 1 == getpid()) {
>>> 236:         if (0 < fork()) {
>> 
>> Not an expert in this area, but don't we also need to handle `SIGTERM` appropriately by forwarding it to the child process if the forking receives it?
>
> @DanHeidinga 
> Do you mean "we need to terminate children if the parent process is terminated"?
> It seems like termination of a process with PID=1 running inside a container will stop a container run, so I guess children will be terminated also. I'd appreciate any reproducible scenario, in case I'm mistaken.

Sorry, that was unclear as I'm fuzzy on the details.

PID 1 is responsible for `wait()`ing on any spawned child processes to ensure they exit before exiting itself.  It also needs to respond to `SIGTERM` by propagating it to all its child processes so they have a chance to gracefully shutdown before `SIGKILL` is sent.  See [0] and [1]

[0] https://petermalmgren.com/pid-1-child-processes-docker/
[1] https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/

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

PR: https://git.openjdk.org/crac/pull/46


More information about the crac-dev mailing list