RFR: 8338281: jshell does not run shutdown hooks
Adam Sotona
asotona at openjdk.org
Tue Aug 27 12:58:07 UTC 2024
On Thu, 15 Aug 2024 16:07:04 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> JShell normally runs user's snippets in a separate VM. And JShell is shutting down, it will send a CLOSE command to the remote agent, and then destroy the remote process. But, the remote process, after receiving the CLOSE command will not finish on its own, run until it is destroyed by `Process.destroy`.
>
> And `Process.destroy` may or may not run any shutdown hooks installed, which is the main point of this bug.
>
> This patch does the following:
> - the remote agent now exits when receiving the CLOSE event (the command loop is stopped, and then the `main` method finishes)
> - the JShell's close will wait for a moment for the remote process to finish
Looks good to me.
-------------
Marked as reviewed by asotona (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/20599#pullrequestreview-2263270723
More information about the kulla-dev
mailing list