-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Retryability
-
None
While testing 4.3.3 with Lambda I noticed that when the Atlas connection limit was reached, some reads would fail with this error:
[ERROR] AutoReconnect: SSL handshake failed: thunder-shard-00-01.gsgkc.mongodb.net:27017: EOF occurred in violation of protocol (_ssl.c:1129) Traceback (most recent call last): File "/var/task/lambda_function.py", line 14, in lambda_handler res = c.test.test.find_one(projection={'_id': 0}) File "/var/task/pymongo/collection.py", line 1459, in find_one for result in cursor.limit(-1): File "/var/task/pymongo/cursor.py", line 1248, in next if len(self.__data) or self._refresh(): File "/var/task/pymongo/cursor.py", line 1165, in _refresh self.__send_message(q) File "/var/task/pymongo/cursor.py", line 1052, in __send_message response = client._run_operation( File "/var/task/pymongo/_csot.py", line 105, in csot_wrapper return func(self, *args, **kwargs) File "/var/task/pymongo/mongo_client.py", line 1330, in _run_operation return self._retryable_read( File "/var/task/pymongo/_csot.py", line 105, in csot_wrapper return func(self, *args, **kwargs) File "/var/task/pymongo/mongo_client.py", line 1442, in _retryable_read with self._socket_from_server(read_pref, server, session) as (sock_info, read_pref): File "/var/lang/lib/python3.9/contextlib.py", line 119, in __enter__ return next(self.gen) File "/var/task/pymongo/mongo_client.py", line 1282, in _socket_from_server with self._get_socket(server, session) as sock_info: File "/var/lang/lib/python3.9/contextlib.py", line 119, in __enter__ return next(self.gen) File "/var/task/pymongo/mongo_client.py", line 1217, in _get_socket with server.get_socket(handler=err_handler) as sock_info: File "/var/lang/lib/python3.9/contextlib.py", line 119, in __enter__ return next(self.gen) File "/var/task/pymongo/pool.py", line 1407, in get_socket sock_info = self._get_socket(handler=handler) File "/var/task/pymongo/pool.py", line 1520, in _get_socket sock_info = self.connect(handler=handler) File "/var/task/pymongo/pool.py", line 1358, in connect sock = _configured_socket(self.address, self.opts) File "/var/task/pymongo/pool.py", line 1074, in _configured_socket _raise_connection_failure(address, exc, "SSL handshake failed: ") File "/var/task/pymongo/pool.py", line 262, in _raise_connection_failure raise AutoReconnect(msg) from error
From this error traceback it's not clear whether a retry was attempted. We should make the error traceback more informative so that we can tell whether the error was from the first attempt or second. I think we can do this by using "raise exc" or "raise exc2 from exc1" instead of bare "raise" when re-raising exceptions.