RFR: 8332065: Calling readLine(null...) or readPassword(null...) on System.console() hangs jshell
Jan Lahoda
jlahoda at openjdk.org
Tue May 28 09:13:24 UTC 2024
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.
-------------
Commit messages:
- Improving tests and implementation.
- 8332065: Calling readLine(null...) or readPassword(null...) on System.console() hangs jshell
Changes: https://git.openjdk.org/jdk/pull/19420/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19420&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8332065
Stats: 30 lines in 2 files changed: 24 ins; 5 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/19420.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/19420/head:pull/19420
PR: https://git.openjdk.org/jdk/pull/19420
More information about the kulla-dev
mailing list