Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error when unable to connect #23

Open
ntabris opened this issue Aug 24, 2022 · 2 comments
Open

Better error when unable to connect #23

ntabris opened this issue Aug 24, 2022 · 2 comments

Comments

@ntabris
Copy link
Member

ntabris commented Aug 24, 2022

@scharlottej13 was using an Atlas Mongo instance and forgot to open the firewall to connections from her Coiled cluster.

The "can't connect to mongo" error is not very clear. Can this be better?

File "/opt/conda/lib/python3.9/site-packages/dask_mongo/core.py", line 86, in fetch_mongo
    return list(coll.aggregate([{"$match": match}, {"$match": match2}]))
  File "/opt/conda/lib/python3.9/site-packages/pymongo/collection.py", line 2428, in aggregate
    with self.__database.client._tmp_session(session, close=False) as s:
  File "/opt/conda/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/opt/conda/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1729, in _tmp_session
    s = self._ensure_session(session)
  File "/opt/conda/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1712, in _ensure_session
    return self.__start_session(True, causal_consistency=False)
  File "/opt/conda/lib/python3.9/site-packages/pymongo/mongo_client.py", line 1657, in __start_session
    self._topology._check_implicit_session_support()
  File "/opt/conda/lib/python3.9/site-packages/pymongo/topology.py", line 538, in _check_implicit_session_support
    self._check_session_support()
  File "/opt/conda/lib/python3.9/site-packages/pymongo/topology.py", line 554, in _check_session_support
    self._select_servers_loop(
  File "/opt/conda/lib/python3.9/site-packages/pymongo/topology.py", line 238, in _select_servers_loop
    raise ServerSelectionTimeoutError(

ServerSelectionTimeoutError("ac-dzkgf0a-shard-00-01.rnleese.mongodb.net:27017: connection closed,ac-dzkgf0a-shard-00-02.rnleese.mongodb.net:27017: connection closed,ac-dzkgf0a-shard-00-00.rnleese.mongodb.net:27017: connection closed, Timeout: 30s, Topology Description: <TopologyDescription id: 6306a6adfd07072a117b1355, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-dzkgf0a-shard-00-00.rnleese.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-dzkgf0a-shard-00-00.rnleese.mongodb.net:27017: connection closed')>, <ServerDescription ('ac-dzkgf0a-shard-00-01.rnleese.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-dzkgf0a-shard-00-01.rnleese.mongodb.net:27017: connection closed')>, <ServerDescription ('ac-dzkgf0a-shard-00-02.rnleese.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-dzkgf0a-shard-00-02.rnleese.mongodb.net:27017: connection closed')>]>")
@ncclementi
Copy link
Contributor

Thank you for reporting this @ntabris

This error seems to be coming from pymongo and not dask-mongo. I wonder what would be the best way to go about this. I've never run into this, because I've mostly run this from LocalClusters. Maybe we can catch that error and report something more descriptive? @jrbourbeau what do you think?

@scharlottej13 In the meantime, would documenting whatever you did to make it work on the coiled+dask-mongo doc?

@scharlottej13
Copy link
Contributor

@scharlottej13 In the meantime, would documenting whatever you did to make it work on the coiled+dask-mongo doc?

absolutely! I spent a bit of time making that section a bit clearer, so I think that will help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants