Integrated: 8338281: jshell does not run shutdown hooks

Jan Lahoda jlahoda at openjdk.org
Thu Aug 29 10:10:21 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

This pull request has now been integrated.

Changeset: 8c8b5801
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/8c8b5801fd9d28a71edf3bd8d1fae857817e27de
Stats:     74 lines in 3 files changed: 72 ins; 1 del; 1 mod

8338281: jshell does not run shutdown hooks

Reviewed-by: asotona

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

PR: https://git.openjdk.org/jdk/pull/20599


More information about the kulla-dev mailing list