ConnectionClosedEvent.getReason is incorrect when a connection is closed due to maxLifeTimeMS

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Connection Management
    • None
    • None
    • Java Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      DefaultConnectionPool.UsageTrackingInternalConnectionItemFactory.getReasonForClosing is incorrect, and returns ConnectionClosedEvent.Reason.POOL_CLOSED even when the connection is closed because of its lifetime exceeding maxLifeTimeMS.

      The maxLifeTimeMS connection string option supported by our driver is non-standard (it's not present in https://github.com/mongodb/specifications/blob/master/source/uri-options/uri-options.md), so naturally https://github.com/mongodb/specifications/blob/master/source/connection-monitoring-and-pooling/connection-monitoring-and-pooling.md#events does not specify a matching reason value for ConnectionClosedEvent. Given that the specification does not allow introducing driver-specific reason values (I infer this from the "valid values are" wording), we should pick a reason that suits best, which, in my opinion, is ConnectionClosedEvent.Reason.IDLE.

            Assignee:
            Unassigned
            Reporter:
            Valentin Kavalenka
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: