Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8225004

Remove invalid assertion in jfr_conditional_flush()

    Details

    • Subcomponent:
      jfr
    • Resolved In Build:
      b24

      Backports

        Description

        JfrFlush.cpp | .hpp
         
        JfrConditionalFlush(Thread* t) {
            if (jfr_is_event_enabled(Event::eventId)) { <<--------------- evaluates to true
              jfr_conditional_flush(Event::eventId, sizeof(Event), t);
            }
          }

        void jfr_conditional_flush(JfrEventId id, size_t size, Thread* t) {
          assert(jfr_is_event_enabled(id), "invariant"); <<-------------------- could evaluate to false
          if (t->jfr_thread_local()->has_native_buffer()) {
            JfrStorage::Buffer* const buffer = t->jfr_thread_local()->native_buffer();
            if (LessThanSize<JfrStorage::Buffer>::evaluate(buffer, size)) {
              JfrFlush f(buffer, 0, 0, t);
            }
          }
        }

        Event settings are updated asynchronously, where event disablement happens after the recording has stopped.

        A thread could have evaluated the initial check to true to enter jfr_conditional_flush(). Depending on visibility, context switching and preemption, another thread could have disabled the event before the thread runs jfr_conditional_flush().

        There is no validity to be asserted at this location, so the assertion needs to be removed.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mgronlun Markus Grönlund
                  Reporter:
                  mgronlun Markus Grönlund
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: