Skip to content

Commit 2ea62c1

Browse files
committed
8303276: Secondary assertion failure in AdapterHandlerLibrary::contains during crash reporting
Reviewed-by: iklam, stuefe
1 parent 0dc03c9 commit 2ea62c1

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/hotspot/share/classfile/classLoaderDataGraph.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include "utilities/growableArray.hpp"
4646
#include "utilities/macros.hpp"
4747
#include "utilities/ostream.hpp"
48-
#include "utilities/vmError.hpp"
4948

5049
volatile size_t ClassLoaderDataGraph::_num_array_classes = 0;
5150
volatile size_t ClassLoaderDataGraph::_num_instance_classes = 0;
@@ -476,7 +475,7 @@ bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
476475
#endif // PRODUCT
477476

478477
bool ClassLoaderDataGraph::is_valid(ClassLoaderData* loader_data) {
479-
DEBUG_ONLY( if (!VMError::is_error_reported()) { assert_locked_or_safepoint(ClassLoaderDataGraph_lock); } )
478+
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
480479
if (loader_data != nullptr) {
481480
if (loader_data == ClassLoaderData::the_null_class_loader_data()) {
482481
return true;

src/hotspot/share/runtime/mutexLocker.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
#include "memory/universe.hpp"
3131
#include "runtime/javaThread.hpp"
3232
#include "runtime/mutexLocker.hpp"
33-
#include "runtime/os.inline.hpp"
3433
#include "runtime/safepoint.hpp"
3534
#include "runtime/vmThread.hpp"
35+
#include "utilities/vmError.hpp"
3636

3737
// Mutexes used in the VM (see comment in mutexLocker.hpp):
3838

@@ -166,7 +166,7 @@ static int _num_mutex;
166166

167167
#ifdef ASSERT
168168
void assert_locked_or_safepoint(const Mutex* lock) {
169-
if (DebuggingContext::is_enabled()) return;
169+
if (DebuggingContext::is_enabled() || VMError::is_error_reported()) return;
170170
// check if this thread owns the lock (common case)
171171
assert(lock != nullptr, "Need non-null lock");
172172
if (lock->owned_by_self()) return;
@@ -177,7 +177,7 @@ void assert_locked_or_safepoint(const Mutex* lock) {
177177

178178
// a weaker assertion than the above
179179
void assert_locked_or_safepoint_weak(const Mutex* lock) {
180-
if (DebuggingContext::is_enabled()) return;
180+
if (DebuggingContext::is_enabled() || VMError::is_error_reported()) return;
181181
assert(lock != nullptr, "Need non-null lock");
182182
if (lock->is_locked()) return;
183183
if (SafepointSynchronize::is_at_safepoint()) return;
@@ -187,7 +187,7 @@ void assert_locked_or_safepoint_weak(const Mutex* lock) {
187187

188188
// a stronger assertion than the above
189189
void assert_lock_strong(const Mutex* lock) {
190-
if (DebuggingContext::is_enabled()) return;
190+
if (DebuggingContext::is_enabled() || VMError::is_error_reported()) return;
191191
assert(lock != nullptr, "Need non-null lock");
192192
if (lock->owned_by_self()) return;
193193
fatal("must own lock %s", lock->name());

0 commit comments

Comments
 (0)