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

XMLWordPrintableJSON

    • 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 (the reasons are also specified at https://github.com/mongodb/specifications/blob/master/source/connection-monitoring-and-pooling/connection-monitoring-and-pooling.md#connection-closed-message, with different descriptions) 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 may pick a reason that suits best, which, in my opinion, is ConnectionClosedEvent.Reason.IDLE. Alternatively, as ross@mongodb.com and maxim.katcharov@mongodb.com proposed, we may change the specification by adding the specific reason we need, and saying that it is to be used by the drivers that have the max connection lifetime setting (at the very least, the C# driver also has it).

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

              Created:
              Updated: