The call to rand() used when selecting a server is unseeded (https://github.com/mongodb/mongo-c-driver/blob/a4bcfffa9c7ffa2e541a3351ec26cfad417cbdcf/src/mongoc/mongoc-topology-description.c#L693)
This tends to manifest itself as uneven balancing between nodes in a cluster.
As a specific example: when libmongoc is used as part of, say, the php-driver:
1. A sudden increase in traffic creates new children (e.g. Apache workers)
2. The new workers create new connections to mongo using the php-driver, and therefore libmongoc
3. All workers initially choose the same server from the cluster as the first value from rand() is always the same
4. One mongo node takes the vast majority of the queries - possibly causing it to become overloaded while other nodes in the cluster receive little traffic
- is depended on by
-
CDRIVER-1681 Backport CDRIVER-1639 to 1.3
- Closed
- is related to
-
CDRIVER-1893 localThresholdMS calculated in microseconds
- Closed
- related to
-
CDRIVER-2067 Server selection is not random on Windows
- Closed