-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8319055: JCMD should not buffer the whole output of commands #23405
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
Conversation
The changes:
AttachListener:
DCmd framework:
Client side:
Test CodeHeapAnalyticsParams.java
|
👋 Welcome back amenkov! A progress list of the required criteria for merging this PR into |
@alexmenkov 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:
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 515 new commits pushed to the
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 |
@alexmenkov The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Do you expect there will be follow up work at some point for the commands that upcall to Java and produce a byte[] to return to the tool? |
I don't see much need in the functionality now (streaming output is useful for commands which produce lengthy output or take long time to execute), but we can add it if desired - need to wrap native writer to OutputStream and use the stream by java handlers (instead of byte buffer) to write command output. |
Thread.dump_to_file is an example that needs this. There will be many more in the future. So while not for this PR we should we thinking about a follow-up to put in the infrastructure to support this. |
@alexmenkov Oh, this is great, many thanks for doing this work! Good explanations too. I had a cursory view over the changes. Will do a more thorough review, and play around with this, when I am back home. With streaming, what is the expected behavior if a command takes too long? Jcmd stops with timeout, and the hotspot JVM then discards the results? Unless the tests are easy to fix, I don't see any problem with just running them in old buffered mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Alex,
Thank you for this. It's very good to have this feature. I'm still reading the code, but I'm submitting these comments as a first round.
I didn't really understand what makes this streaming. The old protocol first sent out the result, and then the data, has this changed?
Thanks,
Johan
We have JDK-8336723 to implement streaming output for commands implemented in java. This PR is lower level and provides functionality required for JDK-8336723 |
When a tool is run interactively (I mean not as part of a testing) there is no timeouts - the tools forward any output from the target VM to stdout until communication channel (socket/pipe) is closed.
Yes, this is the plan for the next step - fix the tests of disable streaming output. |
The protocol works as before. |
test/hotspot/jtreg/serviceability/attach/AttachAPIv2/StreamingOutputTest.java
Show resolved
Hide resolved
test/hotspot/jtreg/serviceability/attach/AttachAPIv2/StreamingOutputTest.java
Show resolved
Hide resolved
Aha, I understand. Before, result code meant "Parsing OK, Command Execution OK", now it means "Parsing OK, starting Command Execution". That's fine by me. Edit: I'll perform another review round soon! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Thanks for waiting.
I understand, I think, more or less what this does on the VM side now. I think that we can simplify the code for the cases when we set an error and don't write any error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Alex,
I'm generally happy with this code. I've got a few more comments, but nothing major.
src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
This looks good to me now. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Added ThreadBlockInVM in complete() method to do the same as old implementation. |
@jdksjolen , @tstuefe can you re-review with the last commit please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks still ok
Thanks for the review |
Going to push as commit cd1be91.
Your commit was automatically rebased without conflicts. |
@alexmenkov Pushed as commit cd1be91. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The fix implements streaming output support for attach protocol.
See JBS issue for evaluation, summary of the changes in the 1st comment.
Testing: tier1..4,hs-tier5-svc
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23405/head:pull/23405
$ git checkout pull/23405
Update a local copy of the PR:
$ git checkout pull/23405
$ git pull https://git.openjdk.org/jdk.git pull/23405/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23405
View PR using the GUI difftool:
$ git pr show -t 23405
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23405.diff
Using Webrev
Link to Webrev Comment