Description
Currently, Graal native images don't register a SIGTERM handler, for reasons described here:
That's fine, unless the Graal native image is the init process (ie, has pid 1), which it is if it's the entry point for a docker container (or any container). Since Linux treats init processes specially, ie, it does not implement a default SIGTERM handler if the process doesn't register one itself, this means using a Graal image as a Docker entry point will mean that the container can never be stopped, only killed (though Docker does send sigkill to the process after a certain timeout if it doesn't respond to siterm, by default 10 seconds).
So, I think at very least, Graal native images should register a sigterm handler when its pid is 1 - this handler doesn't necessarily have to implement the System.exit() logic, it could just invoke the exit system call. That way it would be consistent with when the pid isn't 1, leaving the user to be responsible for overriding the handler if they want shutdown hooks to be executed.