ISSUE SUMMARY
mongos instances maintain connection pools to all shards, and do not manage the lifetime of these connections correctly. This may cause mongos instances to encounter an unrecoverable error and terminate when connecting to a replica set member in the RECOVERING state.
USER IMPACT
mongos instances may terminate in some situations while a replica set member is in the RECOVERING state.
AFFECTED VERSIONS
MongoDB release of 3.0 before 3.0.4.
FIX VERSION
The fix is included in the 3.0.4 production release.
Original description
Issue:
Whenever DBClientReplicaSet objects create connections to the nodes, it attaches the pointer to itself on the new connection. This used to be fine since the lifetime of the DBClientReplicaSet connections are guaranteed to be longer than the connection objects it creates. However, this changed with SERVER-9788. The internal connections to the secondaries are now drawn from the pool and put back to the pool. So the life of the internal connection is now independent of the lifetime of the DBClientReplicaSet connection.
Attaching test script to demonstrate crash.