-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8253033: CheckUnhandledOops check fails in ThreadSnapshot::initialize… #123
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 lmesnik! A progress list of the required criteria for merging this PR into |
@lmesnik 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 |
Webrevs
|
/label serviceability |
@lmesnik |
@@ -886,6 +886,9 @@ void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) { | |||
_thread_status == java_lang_Thread::IN_OBJECT_WAIT_TIMED) { | |||
|
|||
Handle obj = ThreadService::get_current_contended_monitor(thread); |
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.
There must be a safepoint here then.
I think this would be better and safer if blocker_object and blocker_object_owner are Handles. Can you change them to Handles?
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 can't see anywhere a safepoint check would occur in that code. This issue was flagged as being in Loom so perhaps the loom code is different and is what introduces the safepoint check?
But I agree with Coleen that the best solution is to just use Handles.
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.
It is not loom-specific and reproduced n jdk/jdk with -XX:+CheckUnhandledOops.
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.
What do you think about moving
Handle obj = ThreadService::get_current_contended_monitor(thread);
out of scope of block_object oop visibility?
It is my second patch.
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'm missing something. How can a NULL oop get corrupted even if there is a GC?
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.
This is a specific of "CheckUnhandledOops"
I've written in bug comment "Another possible fix would be to disable corruption of NULL unhandled oops. They couldn't be changed really."
We discussed it with Coleen and seems that moving NULL oops out of possible safepoint or handling them seems easier option than changing UnhandledOops.cpp to don't corrupt NULL. It is here:
void UnhandledOops::clear_unhandled_oops() { |
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.
ThreadService::get_current_contended_monitor calls Thread::check_for_dangling_thread_pointer calls ThreadsSMRSupport::is_a_protected_JavaThread_with_lock((JavaThread *) thread),
The potential safepoint is here, where CheckUnhandledOops puts junk in any oop on the stack.
inline bool ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread *thread) {
MutexLocker ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
return is_a_protected_JavaThread(thread);
}
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.
Thanks Coleen. I'm still not sure that CheckUnhandledOops should be touching NULL oops but ...
Leonid the workaround seems okay.
@@ -886,6 +886,9 @@ void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) { | |||
_thread_status == java_lang_Thread::IN_OBJECT_WAIT_TIMED) { | |||
|
|||
Handle obj = ThreadService::get_current_contended_monitor(thread); |
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 can't see anywhere a safepoint check would occur in that code. This issue was flagged as being in Loom so perhaps the loom code is different and is what introduces the safepoint check?
But I agree with Coleen that the best solution is to just use Handles.
@lmesnik This change now passes all automated pre-integration checks. In addition to the automated checks, the change must also fulfill all project specific requirements After integration, the commit message will be:
Since the source branch of this PR was last updated there have been 59 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 automatic rebasing, please merge ➡️ To integrate this PR with the above commit message to the |
/integrate |
@lmesnik Since your change was applied there have been 59 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 306b166. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The NULL oops are corrupted by CheckUnhandledOops and should be re-written with NULL to pass testing with -XX:+CheckUnhandledOops.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/123/head:pull/123
$ git checkout pull/123