-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.6
-
Component/s: None
-
None
Bug in implementation of PYTHON-436 in unreleased version of PyMongo, code in current master branch.
Consider:
import time from pymongo.pool import Pool p = Pool( ('localhost', 27017), 1, None, None, False, False, wait_queue_timeout=100) p.start_request() # Get and close the request socket. request_sock_info = p.get_socket() request_sock_info.sock.close() p.maybe_return_socket(request_sock_info) # Pool won't check for closed sockets if they've been used in the last second. time.sleep(1.5) # Creates new socket, semaphore value still 0. request_sock_info_2 = p.get_socket() assert request_sock_info != request_sock_info_2 p.maybe_return_socket(request_sock_info_2) p.end_request()
Expected: Script completes normally.
Actual: Script hangs 100 seconds, then raises "ConnectionFailure: Timed out waiting for socket from pool with max_size 1 and wait_queue_timeout 100".
The semaphore is decremented if the request socket is broken, when it shouldn't be decremented.
Note also that wait_time_seconds is supposed to be milliseconds but is actually seconds.
- related to
-
PYTHON-538 wait_queue_timeout is seconds or milliseconds?
- Closed
-
PYTHON-436 PyMongo should support capping the number of sockets created
- Closed