[CXX-1332] Mongo-CXX-Driver failed to connect to mongoDB Atlas cluster Created: 05/May/17  Updated: 07/May/17  Resolved: 07/May/17

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: 3.1.1
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Alex Overchenko Assignee: J Rassi
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-2153 mongoc_client_pool_t cannot connect t... Closed

 Description   

Hello

When I try to connect to my cluster by app that written on mongo-cxx-driver, I have such error:
"No suitable servers found: `serverSelectionTimeoutMS` expired: [connection closed calling ismaster on 'librarycluster-shard-00-00-rlx9u.mongodb.net:27017'] [connection closed calling ismaster on 'librarycluster-shard-00-01-rlx9u.mongodb.net:27017'] [connection closed calling ismaster on 'librarycluster-shard-00-02-rlx9u.mongodb.net:27017']: generic server error"
My app connects normally for localhost.
How can I fix it?

With regards,
Alex



 Comments   
Comment by David Golden [ 07/May/17 ]

Closing as (post hoc) duplicate of CDRIVER-2153.

Comment by aarti parikh [ 07/May/17 ]

Thanks for escalating

Comment by Hannes Magnusson [ 07/May/17 ]

I can confirm that example-pool cannot connect to Atlas and have filed CDRIVER-2153.

I have not yet looked at what is happening (or if it is only Atlas, or all ssl), only reproduced the problem against my own Atlas instance.

Comment by aarti parikh [ 07/May/17 ]

Hello,

I am facing the same issue when using the (`mongoc_client_pool_t`) connection pool with the mongo C driver. I am able to successfully connect when I am not using the pool with `mongoc_client_t`. Even the basic example (example-pool.c) included with the mongo C driver FAIL's when connecting to Atlas. http://mongoc.org/libmongoc/current/mongoc_client_pool_t.html. This is HUGE problem for us and preventing us from using Atlas for our application. The Mongo C driver documentation states that "mongoc_client_t is NOT thread-safe and should only be used from one thread at a time. When used in multi-threaded scenarios, it is recommended that you use the thread-safe mongoc_client_pool_t to retrieve a mongoc_client_t for your thread." We have to use the pool because we have a multi-threaded application.

No suitable servers found: `serverSelectionTimeoutMS` expired: [connection closed calling ismaster on 'p1-shard-00-00-xxxx.mongodb.net:27017'] [connection closed calling ismaster on 'p1-shard-00-01-xxxx.mongodb.net:27017']

Thanks
Aarti

Comment by Alex Overchenko [ 06/May/17 ]

Hello.

I'm using this code:
mongocxx::pool pool{mongocxx::uri{my_std_string_uri}};

My mongoc-config.h file (I found it in <PATH_TO_C_DRIVER_INSTALLED_VERSION_PREFIX>\include):
https://gist.github.com/AJIOB/66c7565d201834d165939da79092f306

I'm using mongo-c-driver:x86-windows 1.6.2 version

My mongo shell URI (simpy copy from example from Atlas)
mongo "mongodb://librarycluster-shard-00-00-rlx9u.mongodb.net:27017,librarycluster-shard-00-01-rlx9u.mongodb.net:27017,librarycluster-shard-00-02-rlx9u.mongodb.net:27017/test?replicaSet=LibraryCluster-shard-0" --authenticationDatabase admin --ssl --username LibraryApp --password ***
where *** - my password

I'm using free plan of Atlas Cluster

I'm connecting in May 06 2017 09:20:02 AM GMT+0300 from IP 46.216.172.195 from shell - and it was successful
I'm connecting in May 06 2017 09:26:34 AM GMT+0300 from IP 46.216.172.195 from my app - and it was not successful

With regards,
Alex

Comment by J Rassi [ 05/May/17 ]

Thanks for the information. I have several additional questions:

  • Are you passing "librarycluster-shard-00-01-rlx9u.mongodb.net:27017" into the mongocxx::uri constructor, or are you passing your complete URI string?
  • Can you please upload the C driver header file mongoc-config.h as an attachment to this ticket? You should be able to find it in <PATH_TO_C_DRIVER_INSTALL_PREFIX>\include\libmongoc-1.0\ .
  • Can you please confirm which version of the C driver you are using?
  • Can you please provide the complete command line you used to connect to Atlas via the mongo shell (including any extra options)?
  • Is your Atlas cluster a free tier cluster?
  • Can you provide the timestamp of one of your connection attempts, and the IP address that would be associated with the originating request?

Thanks.

Comment by Alex Overchenko [ 05/May/17 ]

Hello

My URI:
mongodb://LibraryApp:***@librarycluster-shard-00-00-rlx9u.mongodb.net:27017,librarycluster-shard-00-01-rlx9u.mongodb.net:27017,librarycluster-shard-00-02-rlx9u.mongodb.net:27017/Library?ssl=true&replicaSet=LibraryCluster-shard-0&authSource=admin
where *** - my password.

I'm using Windows 10 with Creators Update (version 1703, OS build 15063.250).
I can connect to cluster with MongoDB Compass (official GUI).
I can connect to Cluster with the mongo shell.
For building dlls for Windows I'm using vcpkg tool for Microsoft Visual Studio (you can find it here: https://github.com/Microsoft/vcpkg).

With regards,
Alex

Comment by J Rassi [ 05/May/17 ]

Hi, sorry to hear you're running into connectivity issues. I'll need some additional information to diagnose this problem:

  • Please provide your full Atlas URI.
  • What operating system are you running on this machine?
  • Are you able to connect to the Atlas cluster with the mongo shell, from the same machine (e.g. "mongo --host <YOUR_ATLAS_URI>" at the command prompt)?
  • If available, can you paste the exact invocation of "cmake" you used when building the C++ driver?
  • If available, can you paste the exact invocation of "cmake" or "./configure" you used when building the C driver?

Thanks.

Generated at Wed Feb 07 22:02:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.