Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented May 28, 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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8332065: Calling readLine(null...) or readPassword(null...) on System.console() hangs jshell (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19420/head:pull/19420
$ git checkout pull/19420

Update a local copy of the PR:
$ git checkout pull/19420
$ git pull https://git.openjdk.org/jdk.git pull/19420/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19420

View PR using the GUI difftool:
$ git pr show -t 19420

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19420.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 28, 2024

👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 28, 2024

@lahodaj This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: prappo

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 5 new commits pushed to the master branch:

  • 2edb6d9: 8330386: Replace Opaque4Node of Initialized Assertion Predicate with new OpaqueInitializedAssertionPredicateNode
  • 1850914: 8332864: Parallel: Merge ParMarkBitMapClosure into MoveAndUpdateClosure
  • 2f2cf38: 8332883: Some simple cleanup in vectornode.cpp
  • b5e1615: 8292955: Collections.checkedMap Map.merge does not properly check key and value
  • 86eb5d9: 8329958: Windows x86 build fails: downcallLinker.cpp(36) redefinition

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label May 28, 2024
@openjdk
Copy link

openjdk bot commented May 28, 2024

@lahodaj The following label will be automatically applied to this pull request:

  • kulla

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the kulla kulla-dev@openjdk.org label May 28, 2024
@mlbridge
Copy link

mlbridge bot commented May 28, 2024

Webrevs

Comment on lines +193 to +194
assertEval("System.console().readLine(\"%d\", \"\")", DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, chain(added(Status.VALID), null, EvalException.class));
assertEval("System.console().readPassword(\"%d\", \"\")", DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, chain(added(Status.VALID), null, EvalException.class));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right: IllegalFormatConversionException would cause the same hang.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 28, 2024
@lahodaj
Copy link
Contributor Author

lahodaj commented May 30, 2024

/integrate

@openjdk
Copy link

openjdk bot commented May 30, 2024

Going to push as commit 57bfd0e.
Since your change was applied there have been 37 commits pushed to the master branch:

  • 9a72068: 8332230: jshell throws AssertionError when processing annotations
  • 66d9bfc: 8332725: Binding patterns with inferred type have erroneous node in the AST
  • 2ea365c: 8333099: Missing check for is_LoadVector in StoreNode::Identity
  • 789ac8b: 8333189: Make sure clang on linux uses lld as linker
  • c8eea59: 8332919: SA PointerLocation needs to print a newline after dumping java thread info for JNI Local Ref
  • bc7d9e3: 8333013: Update vmTestbase/nsk/share/LocalProcess.java to don't use finalization
  • 03b7a85: 8332259: JvmtiTrace::safe_get_thread_name fails if current thread is in native state
  • 43a2f17: 8333149: ubsan : memset on nullptr target detected in jvmtiEnvBase.cpp get_object_monitor_usage
  • fed2b56: 8320999: RISC-V: C2 RotateLeftV
  • 6cda4c5: 8321543: Update NSS to version 3.96
  • ... and 27 more: https://git.openjdk.org/jdk/compare/be1d374bc54d43aae3b3c1feace22d38fe2156b6...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 30, 2024
@openjdk openjdk bot closed this May 30, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 30, 2024
@openjdk
Copy link

openjdk bot commented May 30, 2024

@lahodaj Pushed as commit 57bfd0e.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated kulla kulla-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants