-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8373102: com/sun/jdi/MethodInvokeWithTraceOnTest.java can fail with ObjectCollectedException when run with a small heap #28666
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 cjplummer! A progress list of the required criteria for merging this PR into |
|
@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 30 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 |
|
@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
|
sspitsyn
left a comment
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.
alexmenkov
left a comment
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.
I think better solution would be to catch ObjectCollectedException in EventSetImpl.toString implementations (and print al least event name).
But it might not be worth the effort, so it's up to you
I think you're suggesting to implement it in all of the Event subclasses implemented as inner classes of EventSetImpl, right? |
ThreadedEventImpl has the following for toString(): This is the one being triggerd by the test via the thread.name() call. LocatableEventImpl inherits from ThreadedEventImpl and has its own toString() with the same thread.name() reference, so it also needs to be fixed. I think that might be it. |
It would be more complete solution, but even fixing only |
I don't think EventSetImpl.toString() is involved at all, although if called it can suffer the same ObjectCollectedException, which would be fixed if the issue is addressed in the toString() method of the Event sub-classes instead. |
|
I've updated the implementation so now the event type is printed even if there is an ObjectCollectedException. Turns out I was worng about this being triggered by a VirtualThreadEndEvent. It was actually a ClassPrepareEvent, but it was for the class VirtualThreadEndEvent. Here's all the output for the event set, including the handling of the ObjectCollectedException (2nd to last line). |
|
Thank you for the reviews Alex and Serguei! /integrate |
|
Going to push as commit ee0b8a7.
Your commit was automatically rebased without conflicts. |
|
@plummercj Pushed as commit ee0b8a7. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
With JDI tracing enabled, an attempt to trace an event when using SUSPEND_NONE can result in an ObjectCollectedException because the thread is still running and objects that are part of the trace can be collected already. In this case were were dealing with trying to print the thread name for a VirtualThreadEndEvent, and the virtual thread has already exited and been gc'd.
Tested by running test case before change (verified failure) and after change (50 runs without a failure). Will also run tier1 and tier5 svc just to be sure.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28666/head:pull/28666$ git checkout pull/28666Update a local copy of the PR:
$ git checkout pull/28666$ git pull https://git.openjdk.org/jdk.git pull/28666/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28666View PR using the GUI difftool:
$ git pr show -t 28666Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28666.diff
Using Webrev
Link to Webrev Comment