8232905: JFR fails with assertion: assert(t->unflushed_size() == 0) failed: invariant
authormgronlun
Thu, 07 Nov 2019 15:56:56 +0100
changeset 58967 3c2e49d43ba3
parent 58966 6c6cce0f149d
child 58968 7f1daafda27b
8232905: JFR fails with assertion: assert(t->unflushed_size() == 0) failed: invariant Reviewed-by: egahlin
src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp
--- a/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp	Thu Nov 07 15:53:25 2019 +0100
+++ b/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp	Thu Nov 07 15:56:56 2019 +0100
@@ -432,18 +432,17 @@
       assert(oldest_age_node->identity() == NULL, "invariant");
       BufferPtr const buffer = oldest_age_node->retired_buffer();
       assert(buffer->retired(), "invariant");
-      discarded_size += buffer->unflushed_size();
+      discarded_size += buffer->discard();
+      assert(buffer->unflushed_size() == 0, "invariant");
       num_full_post_discard = control().decrement_full();
+      mspace_release_full(oldest_age_node, _age_mspace);
       if (buffer->transient()) {
         mspace_release_full(buffer, _transient_mspace);
-        mspace_release_full(oldest_age_node, _age_mspace);
         continue;
-      } else {
-        mspace_release_full(oldest_age_node, _age_mspace);
-        buffer->reinitialize();
-        buffer->release(); // publish
-        break;
       }
+      buffer->reinitialize();
+      buffer->release(); // publish
+      break;
     }
     JfrBuffer_lock->unlock();
     const size_t number_of_discards = num_full_pre_discard - num_full_post_discard;