8303276: Secondary assertion failure in AdapterHandlerLibrary::contains during crash reporting

Reviewed-by: iklam, stuefe
(cherry picked from commit 2ea62c1369)
This commit is contained in:
Coleen Phillimore
2023-04-24 21:23:56 +00:00
committed by Vitaly Provodin
parent 76c0a0ab3a
commit 11cb6c20f6
2 changed files with 5 additions and 6 deletions

View File

@@ -45,7 +45,6 @@
#include "utilities/growableArray.hpp"
#include "utilities/macros.hpp"
#include "utilities/ostream.hpp"
#include "utilities/vmError.hpp"
volatile size_t ClassLoaderDataGraph::_num_array_classes = 0;
volatile size_t ClassLoaderDataGraph::_num_instance_classes = 0;
@@ -499,7 +498,7 @@ bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
#endif // PRODUCT
bool ClassLoaderDataGraph::is_valid(ClassLoaderData* loader_data) {
DEBUG_ONLY( if (!VMError::is_error_reported()) { assert_locked_or_safepoint(ClassLoaderDataGraph_lock); } )
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
if (loader_data != nullptr) {
if (loader_data == ClassLoaderData::the_null_class_loader_data()) {
return true;

View File

@@ -30,9 +30,9 @@
#include "memory/universe.hpp"
#include "runtime/javaThread.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/vmError.hpp"
// Mutexes used in the VM (see comment in mutexLocker.hpp):
@@ -169,7 +169,7 @@ static int _num_mutex;
#ifdef ASSERT
void assert_locked_or_safepoint(const Mutex* lock) {
if (DebuggingContext::is_enabled()) return;
if (DebuggingContext::is_enabled() || VMError::is_error_reported()) return;
// check if this thread owns the lock (common case)
assert(lock != nullptr, "Need non-null lock");
if (lock->owned_by_self()) return;
@@ -180,7 +180,7 @@ void assert_locked_or_safepoint(const Mutex* lock) {
// a weaker assertion than the above
void assert_locked_or_safepoint_weak(const Mutex* lock) {
if (DebuggingContext::is_enabled()) return;
if (DebuggingContext::is_enabled() || VMError::is_error_reported()) return;
assert(lock != nullptr, "Need non-null lock");
if (lock->is_locked()) return;
if (SafepointSynchronize::is_at_safepoint()) return;
@@ -190,7 +190,7 @@ void assert_locked_or_safepoint_weak(const Mutex* lock) {
// a stronger assertion than the above
void assert_lock_strong(const Mutex* lock) {
if (DebuggingContext::is_enabled()) return;
if (DebuggingContext::is_enabled() || VMError::is_error_reported()) return;
assert(lock != nullptr, "Need non-null lock");
if (lock->owned_by_self()) return;
fatal("must own lock %s", lock->name());