Prevent assertion failure in metrics collection

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: Change streams
    • None
    • Query Execution
    • Fully Compatible
    • QE 2026-04-27
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      BF-42715 uncovered an issue during cursor metrics update when wall clock time goes backward.
      The cursor lifetime histogram metric is updated as part of cursor disposal, but it must not be called with a negative value. The lifetime can become negative if wall clock time goes backwards, e.g. due to an NTP adjustment.
      When the histogram is updated with a negative lifetime value, the histogram record function will throw, which prevents proper cursor disposal. This will cause follow-up assertion failures in the cursor destructor because of the incomplete disposal.

      This change ensures that only non-negative values are posted to the lifetime histogram, and that disposal continues even in the case of metrics-related exceptions.

            Assignee:
            Jan Steemann
            Reporter:
            Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: