-
Notifications
You must be signed in to change notification settings - Fork 5.8k
JDK-8317920: JDWP-agent sends broken exception event with onthrow option #16145
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
👋 Welcome back jbechberger! A progress list of the required criteria for merging this PR into |
@parttimenerd The following label 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 list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
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.
LGTM
@parttimenerd 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 154 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 |
/reviewers 2 |
Do you have a test case for this? |
@plummercj |
No. But if neccessary I could write one analogous to the OnJcmdTest, using |
It would be good if you could do that. Also, can you provide a backtrace for the NPE in the JBS issue. |
Also, does |
I can confirm that it doesn't work properly in JDK 8, I have to check older JDKs. But it kind of worked, because it started a debugging session after the specified exception had been thrown. It just didn't send a proper exception event. It's definitely a useful feature. |
So with 8 there is no NPE? Maybe JDI or jdb used to do something different and just swallowed exception event. Seeing the NPE stack trace would help determine what has changed to cause this behavior difference. |
There is an NPE on JDK 8. The onthrow option doesn't work properly there too. The bug is in the code since it is on GitHub. The stack trace in JDB looks exactly the same in JDK 8 as in JDK 21. |
So when you said "But it kind of worked", you were referring to both JDK 8 and current JDK, and were just pointing out that it did start the debugging session. I'd still like to see the NPE stack trace. |
Sorry, I forgot to put the NPE somewhere. Here the NPE of JDB:
|
Ok. I think overall the changes look good. I'd still like to see a test. Also, I'd like to see the jdb output after the fix. Maybe include the |
After the fix (see https://mostlynerdless.de/blog/2023/10/11/jdwp-onthrow-and-a-mysterious-error/):
The problem started appearing with JDK 1.5. I'm currently working on a test case and hope to add it in the next few hours. |
I added a minimal test case which starts a debugging session for a basic program and attaches to it via JDI to check that the JDWP-agent throws an exception event with non-null properties. The case fails for the current master and succeeds with this PR. |
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.
Overall the changes look good except one minor comment typo I noted. I'd like to first run this through our CI testing to make sure there are no issues.
Co-authored-by: Chris Plummer <chris.plummer@oracle.com>
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.
Changes look good. I'm approving, but I think also @RealCLanger should re-review since a lot has changed since his review, including the addition of the test.
Thanks @plummercj for checking that so thoroughly, I couldn't do that. I only have a few minor suggestions for cleanups. |
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 good, just a few last minor flaws. 😉
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 good to me now.
/integrate |
Going to push as commit 8f4ebd8.
Your commit was automatically rebased without conflicts. |
@parttimenerd Pushed as commit 8f4ebd8. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
/backport jdk21u |
@parttimenerd the backport was successfully created on the branch parttimenerd-backport-8f4ebd89 in my personal fork of openjdk/jdk21u. To create a pull request with this backport targeting openjdk/jdk21u:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u:
|
/backport jdk17u |
@parttimenerd Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u with the title |
This is the wrong repo. For jdk17 you have to got to jdk17u-dev. |
Oh, thank you. |
/backport jdk17u-dev |
@parttimenerd Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u-dev with the title |
@parttimenerd Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk11u. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk11u with the title |
/backport jdk11u-dev |
@parttimenerd Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk11u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk11u-dev with the title |
Fix
onthrow
issue by passing the event info to theinitialize
method.This prevents
jdb
from receiving a broken exception event and throwing an internal NullPointerException, upon attaching to the JDWP-agent.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16145/head:pull/16145
$ git checkout pull/16145
Update a local copy of the PR:
$ git checkout pull/16145
$ git pull https://git.openjdk.org/jdk.git pull/16145/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16145
View PR using the GUI difftool:
$ git pr show -t 16145
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16145.diff
Webrev
Link to Webrev Comment