-
Notifications
You must be signed in to change notification settings - Fork 6k
8269542: JDWP: EnableCollection support is no longer spec compliant after JDK-8255987 #7134
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
…ref is strong due to a pin, pinAll, or both.
👋 Welcome back cjplummer! A progress list of the required criteria for merging this PR into |
/issue add 8269542,8258071 |
@plummercj This issue is referenced in the PR title - it will now be updated. Adding additional issue to issue list: |
@plummercj 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
|
@pliden can you have a look at this? |
Hi Chris, Your links to JDK-8269232 actually go to the wrong bug. |
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 Chris,
I've read through what you've written and the related bug reports to refresh my memory on this. I understand the approach you've taken and it makes sense as described. I think the implementation can be simplified a little by not using three fields - see below. But overall this seems okay.
Thanks,
David
Ok. Fixed. |
…ue of isPinAll and isCommonPin. Add comments for some boolean args.
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 Chris,
Update looks good. Just one query on something that doesn't quite look right.
Thanks,
David
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.
Fixes for NULL case look good.
Thanks,
David
@plummercj 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 91 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 |
Thanks for the review and noticing these issues. |
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.
@plummercj I haven't reviewed, this but the Eclipse-based reproducer from JDK-8269232.still passes with this change. Thumbs up.
Thanks for verifying! |
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.
Change looks good to me.
Thanks for the reviews Per and David! |
/integrate |
Going to push as commit 841eae6.
Your commit was automatically rebased without conflicts. |
@plummercj Pushed as commit 841eae6. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The JDWP spec mentions nothing about
DisableCollection
andEnableCollection
tracking the depth or nesting of the commands. This means thatEnableCollection
should enable collection no matter how manyDisableCollection
commands were done before it. This is how the debug agent used to work before JDK-8255987. Now the commands' nesting level is tracked, meaning that if there are twoDisableCollection
commands, you need twoEnableCollection
commands to re-enable collection. This is contrary to what the spec says. Only oneEnableCollection
command should be needed to undo any number ofDisableCollection
commands.Note, JDWP differs from JDI here. The JDI spec explicitly says you need an enable for each disable in order to enable collection again. JDI tracks the disable count. Also, JDI only does the JDWP
DisableCollection
for the first disable, and only does the JDWPEnableCollection
when the count goes back to 0. For this reason this JDWP bug cannot be reproduced by using JDI. You have to use JDWP directly. Unfortunately we have very limited direct testing of JDWP. JDWP testing mostly is done via JDI. What little JDWP testing we do have pretty much just verifies that reply packets are as expected. They don't verify VM or application behavior. For example, we have no JDWP test that tests thatDisableCollection
actually disables the collecting of the object. For this reason I have not added a test for this CR.Another issue is that support for
DisableCollection/EnableCollection
nesting was intermixed with the support for havingVM.Suspend
disable collection on all objects (which was the main purpose of JDK-8255987). As a result, if you do aVM.Suspend
and then do aDisableCollection
on anObjectReference
, that object can now be collected, even though the spec says it should not be during aVM.Suspend
. This issues is documented in JDK-8258071, and is also fixed by this PR.To fix both of these issues,
node->strongCount
should go back to being a boolean (node->isStrong
) like it was before JDK-8255987. Also, separate flags should be maintained to indicate if the reference is strong due to aDisableCollection
and/or due toVM.Suspend
. We need a flag for each, because it's possible that both can be true at the same time. Whennode->isStrong
is true, if there is anEnableCollection
it only gets set false if there is no currentVM.Suspend
. Likewise was ifVM.Resume
is done, it only gets set false if there is no outstandingDisableCollection
.There should be no need for maintaining a count anymore since we aren't suppose to for
DisableCollection/EnableCollection
, and there is no need to forVM.Suspend/Resume
, since it only callscommonRef_pinAll()
code when thesuspendAllCount
is changed to/from 0.Please also note JDK-8269232, which was also introduced by this nesting level counting, but is being fixed in more direct manner to keep the changes simple. The fix for CR replaces the changes for JDK-8269232.
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7134/head:pull/7134
$ git checkout pull/7134
Update a local copy of the PR:
$ git checkout pull/7134
$ git pull https://git.openjdk.java.net/jdk pull/7134/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7134
View PR using the GUI difftool:
$ git pr show -t 7134
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7134.diff