-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8307517: Add VMErrorCallback infrastructure to extend hs_err dumping #13824
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 stefank! A progress list of the required criteria for merging this PR into |
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.
@stefank 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 29 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 |
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.
I have also experimented with using this functionality to only record the last unloading events for a specific unloading cycle. (And have the callback print the events if a crash occurred during the cycle). As I found that in release builds the majority of the time is spent inside Events::log_class_unloading
for do_unloading.
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 looks quite neat but I'm not clear on the need for the VMErrorCallbackMark - can't the callback link/unlink itself at construction/destruction?
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.
Nice, I like it.
@@ -213,4 +213,27 @@ class VMError : public AllStatic { | |||
static int prepare_log_file(const char* pattern, const char* default_pattern, bool overwrite_existing, char* buf, size_t buflen); | |||
|
|||
}; | |||
|
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.
pre-existing, can you please add a prototype decl for outputStream?
}; | ||
|
||
class VMErrorCallbackMark : public StackObj { | ||
Thread* _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.
Why would we need the thread here? Why not use Thread::current in dtor? This object is only used as stack object, right?
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 was treading in Runtime code and Coleen usually wants to use cached-away Thread pointers instead of calling Thread::current() repeatedly. I'm fine with either solution.
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.
Given the context it would have to be Thread::current_or_null_safe()
. But yes we prefer not to re-materialize the current thread if we already have it at hand.
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.
Could you explain why it would have to be Thread::current_or_null_safe()
? The constructor and destructor are run in "normal" JVM code and not in the error handler.
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.
Sorry my mistake.
I like it better this way. Otherwise you dictate that the callback obj itself has to live on the stack. It may be large, or it may be shared between different threads. |
Yes it could. It has a couple of drawbacks, but it's unclear to me if those are important:
The main advantage is that there's one less class and the linking-site can become a one-liner. I can go either way, so it would be good if the reviewers could chime in with their preference. This is what it would look like: |
I prefer the explicit RAII object, separate from the callback. |
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 fine with the code as-is. Thanks.
Thanks for reviewing! In the interest of getting this pushed before the Generational ZGC, I'm going to integrate it now. FWIW, I'm not opposed to doing some follow-up style changes if we decide that this should be further tweaked. |
Going to push as commit 33245d6.
Your commit was automatically rebased without conflicts. |
Sometimes when we crash in the GC we'd like to get some more information about what was going on the crashing thread. One example is when Generational ZGC crashes during store barrier flushing. From https://github.com/openjdk/zgc/blob/349cf9ae38664991879402a90c5e23e291f1c1c3/src/hotspot/share/gc/z/zStoreBarrierBuffer.cpp#L245
If we crash in ZStoreBarrierBuffer::flush, we print the information above into the hs_err file.
We've found this information to be useful and would like to upstream the infrastructure separately from the much larger Generational ZGC PR.
Testing: this has been brewing and been used in the Generational ZGC repository for a long time.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13824/head:pull/13824
$ git checkout pull/13824
Update a local copy of the PR:
$ git checkout pull/13824
$ git pull https://git.openjdk.org/jdk.git pull/13824/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13824
View PR using the GUI difftool:
$ git pr show -t 13824
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13824.diff
Webrev
Link to Webrev Comment