We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84fd04e commit 18de676Copy full SHA for 18de676
pymongo/pool.py
@@ -1200,8 +1200,8 @@ def _get_socket(self, all_credentials):
1200
self.active_sockets += 1
1201
1202
# We've now acquired the semaphore and must release it on error.
1203
+ sock_info = None
1204
try:
- sock_info = None
1205
while sock_info is None:
1206
1207
with self.lock:
@@ -1214,6 +1214,9 @@ def _get_socket(self, all_credentials):
1214
sock_info = None
1215
sock_info.check_auth(all_credentials)
1216
except Exception:
1217
+ if sock_info:
1218
+ # We checked out a socket but authentication failed.
1219
+ sock_info.close_socket(ConnectionClosedReason.ERROR)
1220
self._socket_semaphore.release()
1221
1222
self.active_sockets -= 1
0 commit comments