add interruptInUseConnections client option

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

        1. Summary

      Adds a boolean `interruptInUseConnections` `MongoClientOptions` (default `true`, preserving the current SDAM spec behaviour).

      When the SDAM monitor heartbeat times out, the driver clears the connection pool with `interruptInUseConnections: true`, which rejects in-flight operations with a `PoolClearedOnNetworkError`. For operations the driver does *not* retry — notably tailable `getMore` — this surfaces as an unrecoverable error after a transient blip such as a host being suspended/resumed (for example a laptop sleeping).

      Setting `interruptInUseConnections: false` makes a monitor network timeout still clear the pool (`ResetPool`) but *not* interrupt in-use connections, so those in-flight operations are left untouched and resume once the server is reachable again. The pool is still cleared and the driver reconnects as usual.

        1. Motivation

      There is currently no supported way to opt out of the in-use connection interruption introduced with the `interruptInUseConnections` SDAM behaviour. This is the root of a long-standing "idle crash" reported downstream in Meteor (meteor/meteor#13108): when a laptop sleeps, the local `mongod` is frozen, the monitor times out, and the oplog tail's `getMore` — which the driver never retries — rejects with `PoolClearedOnNetworkError` and crashes the process. The same applies to any long-lived/non-retried operation across a transient network blip.

      pr: https://github.com/mongodb/node-mongodb-native/pull/4961

            Assignee:
            Unassigned
            Reporter:
            Italo José (EXT)
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: