PYTHON-903 - Inc semaphore after network err with auth.
There was a semaphore leak in MongoReplicaSet.__socket, though not critical. After getting disconnected during auth, it discards the server's whole pool. Then it wakes the monitor and creates a new pool, recovering from the leak. That's fine unless, at the moment we wake the monitor, we're unlucky and it's just started running using the previous pool (due to periodic monitoring or whatever). In that case it can't get a socket, and tells the main thread it thinks the primary's down *again*. Thus we threw two errors instead of one, but we still recover eventually.
This commit is contained in:
parent
f05e800820
commit
9fc992b423
@ -1306,7 +1306,9 @@ class MongoReplicaSetClient(common.BaseObject):
|
||||
|
||||
try:
|
||||
self.__check_auth(sock_info)
|
||||
except OperationFailure:
|
||||
except:
|
||||
# No matter whether an auth failure or network error, increment
|
||||
# the pool's semaphore by returning the socket.
|
||||
member.maybe_return_socket(sock_info)
|
||||
raise
|
||||
return sock_info
|
||||
|
||||
Loading…
Reference in New Issue
Block a user