-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: network
-
None
In SDAM, connection pools are cleared in these situations:
1. A network error on an app socket (any error during handshake, or a non-timeout error after).
2. A "shutdown error" on any server, or a "not master" error on <=4.0 server.
3. Any network error during monitoring.
libmongoc does not have a connection pool, but instead a client pool. It partially implements some of this behavior for the connections it has to a server, but it needs improvement.
(1) is partially implemented in mongoc-cluster.c by calls to mongoc_cluster_disconnect_node. But this only disconnects the current client's connection to the server. It does not disconnect other clients. And it does not disconnect the topology scanner (which may be due to the fact that the topology scanner is not thread safe).
(2) similarly only applies to the client receiving the error. It does not close connections on other clients in the pool or the topology scanner.
(3) is currently implemented (though CDRIVER-3625 may change this). There is a timestamp field on a topology scanner node. It is set to the current time every time the scanner node re-establishes connection.