8221121: applications/microbenchmarks are encountering crashes in tier5
Reviewed-by: egahlin, dholmes
--- a/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp Tue May 28 06:42:32 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp Tue May 28 13:28:48 2019 +0200
@@ -132,10 +132,6 @@
OrderAccess::release_store(&_identity, (const void*)NULL);
}
-void JfrBuffer::clear_identity() {
- _identity = NULL;
-}
-
bool JfrBuffer::acquired_by(const void* id) const {
return identity() == id;
}
--- a/src/hotspot/share/jfr/recorder/storage/jfrBuffer.hpp Tue May 28 06:42:32 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/storage/jfrBuffer.hpp Tue May 28 13:28:48 2019 +0200
@@ -145,8 +145,6 @@
return _identity;
}
- void clear_identity();
-
void acquire(const void* id);
bool try_acquire(const void* id);
bool acquired_by(const void* id) const;
--- a/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp Tue May 28 06:42:32 2019 -0400
+++ b/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp Tue May 28 13:28:48 2019 +0200
@@ -312,7 +312,11 @@
static bool insert_full_age_node(JfrAgeNode* age_node, JfrStorageAgeMspace* age_mspace, Thread* thread) {
assert(JfrBuffer_lock->owned_by_self(), "invariant");
+ assert(age_node != NULL, "invariant");
+ assert(age_node->acquired_by_self(), "invariant");
assert(age_node->retired_buffer()->retired(), "invariant");
+ age_node->release(); // drop identity claim on age node when inserting to full list
+ assert(age_node->identity() == NULL, "invariant");
age_mspace->insert_full_head(age_node);
return true;
}
@@ -329,8 +333,8 @@
return false;
}
}
+ assert(age_node != NULL, "invariant");
assert(age_node->acquired_by_self(), "invariant");
- assert(age_node != NULL, "invariant");
age_node->set_retired_buffer(buffer);
control.increment_full();
return insert_full_age_node(age_node, age_mspace, thread);
@@ -412,6 +416,7 @@
if (oldest_age_node == NULL) {
break;
}
+ assert(oldest_age_node->identity() == NULL, "invariant");
BufferPtr const buffer = oldest_age_node->retired_buffer();
assert(buffer->retired(), "invariant");
discarded_size += buffer->unflushed_size();
@@ -423,7 +428,7 @@
} else {
mspace_release_full(oldest_age_node, _age_mspace);
buffer->reinitialize();
- buffer->release(); // pusb
+ buffer->release(); // publish
break;
}
}
@@ -637,12 +642,12 @@
JfrAgeNode* last = NULL;
while (node != NULL) {
last = node;
+ assert(node->identity() == NULL, "invariant");
BufferPtr const buffer = node->retired_buffer();
assert(buffer != NULL, "invariant");
assert(buffer->retired(), "invariant");
processor.process(buffer);
// at this point, buffer is already live or destroyed
- node->clear_identity();
JfrAgeNode* const next = (JfrAgeNode*)node->next();
if (node->transient()) {
// detach