JFR: Incorrect duration after chunk rotation

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 20
    • Affects Version/s: 20
    • Component/s: hotspot
    • None
    • jfr
    • b27
    • Verified

      When the JVM rotates to a new chunk, a notified flag is set. This is so an ongoing Java event can redo the event with a stack trace ID that is present in the new chunk. This means the logic in the commit method is executed twice.

      Currently there is a check if the startTime has been set.

      In the first iteration, it's zero, indicating an event without a duration.

      In the second iteration, it's no longer zero, and the code incorrectly assumes this was because the user called begin(), so it complete the event with a duration. This leads to events with a small duration, typically a few microseconds.

      This is a regression introduced in JDK 19. See JDK-8282420 JFR: Remove event handlers. Previously the repetition happened in a separate method, meaning the startTime was a new stack variable instead of a field value, so it never occurred.

      Impact: Medium, no dataloss but could potentially break program that expects the duration to be zero.
      Likelihood: High, likely to happen in a longer recording if JFR is being used
      Workaround: High, no known workaround

      MHH => P2

            Assignee:
            Erik Gahlin
            Reporter:
            Erik Gahlin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: