-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8369622: GlobalChunkPoolMutex is recursively locked during error handling #27869
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,11 @@ void MallocMemorySnapshot::copy_to(MallocMemorySnapshot* s) { | |
// Use lock to make sure that mtChunks don't get deallocated while the | ||
// copy is going on, because their size is adjusted using this | ||
// buffer in make_adjustment(). | ||
ChunkPoolLocker lock; | ||
ChunkPoolLocker::LockStrategy ls = ChunkPoolLocker::LockStrategy::Lock; | ||
if (VMError::is_error_reported() && VMError::is_error_reported_in_current_thread()) { | ||
ls = ChunkPoolLocker::LockStrategy::Try; | ||
} | ||
Comment on lines
+68
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking more, we could simply always do this check in the constructor and do away with the "strategy" flag altogether. Arguably this would be reasonable behaviour for every Mutexlocker (though it may slow things down a little). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a version that did this but Johan was worried about global behavior so wanted to limit it to just NMT reporting on error to be safe. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay. Worth having a discussion whether all "lockers" should adopt this error reporting behaviour. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah. Not sure about that for this lock or in general. Right now it's ad-hoc. |
||
ChunkPoolLocker cpl(ls); | ||
s->_all_mallocs = _all_mallocs; | ||
size_t total_size = 0; | ||
size_t total_count = 0; | ||
|
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.
Possible enhancement: explicitly check for
Try
and thenShouldNotReachHere
in the else case. I'm not sure if this is necessary for a bandaid fix like this, though.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 suppose I could add it. The enum only has two choices so it seems like overkill though.