Integrated: 8332065: Calling readLine(null...) or readPassword(null...) on System.console() hangs jshell

Jan Lahoda jlahoda at openjdk.org
Thu May 30 06:05:06 UTC 2024


On Tue, 28 May 2024 09:08:01 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> JShell supports using `System.console()` when running snippets in a separate VM (the agent). This works by re-sending requests from the agent to the main process.
> 
> For some `Console` methods, like `readLine`, this has two phases - first a prompt is sent, and then input is received. But, there's a mistake on the way this is handled: the protocol starts a "transaction", and then goes to process the prompt. And if the prompt processing fails, the "transaction" never ends, and the communication locks.
> 
> The proposal here is to do the prompt processing before starting the communication, so if it fails, there are no problems with the communication.

This pull request has now been integrated.

Changeset: 57bfd0e3
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/57bfd0e393c58b01cb427a6fbee8ea541ae30efb
Stats:     30 lines in 2 files changed: 24 ins; 5 del; 1 mod

8332065: Calling readLine(null...) or readPassword(null...) on System.console() hangs jshell

Reviewed-by: prappo

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

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


More information about the kulla-dev mailing list