Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3645

Cluster nodes are not removed on topology description change

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.27.2
    • Affects Version/s: None
    • Component/s: network
    • None
    • Needed
    • Hide

      Suggest adding the following under the "Pooled Mode" section of https://www.mongodb.com/docs/languages/c/c-driver/current/libmongoc/guides/connection-pooling/#std-label-mongoc_connection_pooling:

      .. note::
      
         Return a checked out :symbol:`mongoc_client_t` to the pool with :symbol:`mongoc_client_pool_push` quickly to encourage reuse of clients among threads.
      

      Rationale: A customer in HELP-59749 was unaware of the expected use, and had clients checked out for long durations in testing.

      Show
      Suggest adding the following under the "Pooled Mode" section of https://www.mongodb.com/docs/languages/c/c-driver/current/libmongoc/guides/connection-pooling/#std-label-mongoc_connection_pooling: .. note:: Return a checked out :symbol:`mongoc_client_t` to the pool with :symbol:`mongoc_client_pool_push` quickly to encourage reuse of clients among threads. Rationale: A customer in HELP-59749 was unaware of the expected use, and had clients checked out for long durations in testing.

      For a client pool, a mongoc_cluster_t keeps a set of nodes. Each node is associated with a server, and contains an application-use connection. Nodes are created on demand as operations need them.

      Cluster nodes are removed during some errors (e.g. a network error calling mongoc_cluster_disconnect_node). But a cluster node for a server will not be removed when the server is removed from the topology description.

      That server will no longer be eligible for server selection. So I believe the cluster node will remain around until the client is destroyed.

      This could be problematic for long running applications. If a server is periodically added and removed to the topology (perhaps due to poor connectivity or maintenance), many unusable cluster nodes could hang around.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: