-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.6
-
Component/s: Auth, Connection Mgmt
-
None
-
Environment:M10 MongoDB Atlas server, Python 3.6.3 on ubuntu 17.10, with pymongo 3.6.0
I'm evaluating MongoDB in general and the Atlas service in general, and am having some serious issues with reliability.
When connecting, I periodically (but inconsistently) get an error.
This is the usual error I get when connection fails:
(venv) ixokai@ixobuntu:~/Projects/eyrie$ python -m eyrie.run Starting... Traceback (most recent call last): File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 925, in _get_socket_no_auth sock_info = self.sockets.pop() KeyError: 'pop from an empty set' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/ixokai/Projects/eyrie/eyrie/run.py", line 11, in <module> print(us.find_one({"short_name": "shansen"})) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/collection.py", line 1224, in find_one for result in cursor.limit(-1): File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/cursor.py", line 1176, in next if len(self.__data) or self._refresh(): File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/cursor.py", line 1087, in _refresh self.__send_message(q) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/cursor.py", line 924, in __send_message **kwargs) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1026, in _send_message_with_response exhaust) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1037, in _reset_on_error return func(*args, **kwargs) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/server.py", line 85, in send_message_with_response with self.get_socket(all_credentials, exhaust) as sock_info: File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/server.py", line 138, in get_socket with self.pool.get_socket(all_credentials, checkout) as sock_info: File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 891, in get_socket sock_info = self._get_socket_no_auth() File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 928, in _get_socket_no_auth sock_info = self.connect() File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 857, in connect None)) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/network.py", line 116, in command reply = receive_message(sock, request_id) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/network.py", line 147, in receive_message _receive_data_on_socket(sock, 16)) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/network.py", line 176, in _receive_data_on_socket raise AutoReconnect("connection closed") pymongo.errors.AutoReconnect: connection closed
A few times, though, I've gotten this:
(venv) ixokai@ixobuntu:~/Projects/eyrie$ python -m eyrie.run Starting... Traceback (most recent call last): File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 925, in _get_socket_no_auth sock_info = self.sockets.pop() KeyError: 'pop from an empty set' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 842, in connect sock = _configured_socket(self.address, self.opts) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 744, in _configured_socket sock = _create_connection(address, options) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 728, in _create_connection raise err File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 721, in _create_connection sock.connect(sa) socket.timeout: timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/ixokai/Projects/eyrie/eyrie/run.py", line 9, in <module> print(us.find_one({"short_name": "shansen"})) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/collection.py", line 1224, in find_one for result in cursor.limit(-1): File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/cursor.py", line 1176, in next if len(self.__data) or self._refresh(): File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/cursor.py", line 1087, in _refresh self.__send_message(q) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/cursor.py", line 924, in __send_message **kwargs) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1026, in _send_message_with_response exhaust) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1037, in _reset_on_error return func(*args, **kwargs) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/server.py", line 85, in send_message_with_response with self.get_socket(all_credentials, exhaust) as sock_info: File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/server.py", line 138, in get_socket with self.pool.get_socket(all_credentials, checkout) as sock_info: File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 891, in get_socket sock_info = self._get_socket_no_auth() File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 928, in _get_socket_no_auth sock_info = self.connect() File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 864, in connect _raise_connection_failure(self.address, error) File "/home/ixokai/Projects/eyrie/venv/lib/python3.6/site-packages/pymongo/pool.py", line 259, in _raise_connection_failure raise NetworkTimeout(msg) pymongo.errors.NetworkTimeout: eyrie-apt-demo-dev-shard-00-00-ebuln.mongodb.net:27017: timed out