-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
When a connection is closed while reading a response, pymongo raises an error without the host. For example:
File "/Users/shane/git/mongo-python-driver/test/test_client.py", line 1579, in test_network_error_message client.pymongo_test.test.find_one({}) File "/Users/shane/git/mongo-python-driver/pymongo/collection.py", line 1261, in find_one for result in cursor.limit(-1): File "/Users/shane/git/mongo-python-driver/pymongo/cursor.py", line 1199, in next if len(self.__data) or self._refresh(): File "/Users/shane/git/mongo-python-driver/pymongo/cursor.py", line 1120, in _refresh self.__send_message(q) File "/Users/shane/git/mongo-python-driver/pymongo/cursor.py", line 995, in __send_message response = client._run_operation_with_response( File "/Users/shane/git/mongo-python-driver/pymongo/mongo_client.py", line 1271, in _run_operation_with_response return self._retryable_read( File "/Users/shane/git/mongo-python-driver/pymongo/mongo_client.py", line 1374, in _retryable_read return func(session, server, sock_info, slave_ok) File "/Users/shane/git/mongo-python-driver/pymongo/mongo_client.py", line 1263, in _cmd return server.run_operation_with_response( File "/Users/shane/git/mongo-python-driver/pymongo/server.py", line 117, in run_operation_with_response reply = sock_info.receive_message(request_id) File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", line 717, in receive_message self._raise_connection_failure(error) File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", line 715, in receive_message return receive_message(self, request_id, self.max_message_size) File "/Users/shane/git/mongo-python-driver/pymongo/network.py", line 193, in receive_message _receive_data_on_socket(sock_info, 16, deadline)) File "/Users/shane/git/mongo-python-driver/pymongo/network.py", line 264, in _receive_data_on_socket raise AutoReconnect("connection closed") pymongo.errors.AutoReconnect: connection closed
It would be better to include the host like we do for other connection errors:
pymongo.errors.AutoReconnect: localhost:27017: connection closed
- causes
-
PYTHON-2615 Test Failure - test_client.TestClient.test_socket_timeout with eventlet and TLS
- Closed
-
PYTHON-2616 Test failure - test_client.TestClient.test_network_error_message
- Closed
- related to
-
PYTHON-1157 SSL timeouts should raise NetworkTimeout, not AutoReconnect
- Closed