[CDRIVER-2153] mongoc_client_pool_t cannot connect to MongoDB Atlas Created: 07/May/17 Updated: 28/Oct/23 Resolved: 10/May/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 1.5.5, 1.6.2 |
| Fix Version/s: | 1.6.3, 1.7.0 |
| Type: | Bug | Priority: | Blocker - P1 |
| Reporter: | Hannes Magnusson | Assignee: | Hannes Magnusson |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Description |
|
| Comments |
| Comment by Githook User [ 09/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: Merge branch '
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 09/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: Merge branch '
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 09/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: Merge branch '
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 09/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: Merge branch '
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 09/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: Merge branch '
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 09/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: This will only work on certain ubuntu versions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 09/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 09/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: Also add support for setting the ssl_opts through the URI in pool mode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by aarti parikh [ 09/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I have some good news. I did not use your branch but I copied over the patch you put in namely these lines below + the defines when I create the pool and it WORKS great! I am off to using Atlas. Thank you much.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Hannes Magnusson [ 08/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
No, enabling weak_cert_validate and/or invalid_hostname will prevent you from connecting to atlas. If you have the means to compile from git and willing to try out my fix for this issue, could you try my " Something like
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by aarti parikh [ 08/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I am not connecting to localhost, but to my atlas instance. I did not want to share my Atlas credentials on a public JIRA board. Do you think adding the weak_cert_validation +hostname flags would allow me to connect and iterate through the collection, If so I can try that. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Hannes Magnusson [ 08/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
aarti Are you actually connecting to localhost in your example? I believe it "hangs" due to not being able to verify the certificate in your example. I did discover another Atlas related bug, in that if you disable certificate verification (e.g. set mongoc_ssl_opt_t.weak_cert_validation = true, or .allow_invalid_hostname = true) then we don't actually send the SNI which will result in an error in Atlas. See | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by aarti parikh [ 07/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I have tried all sorts of options to get the pool to work with a cursor but no luck. I modified your sample code to simply make one call with the pool and to print the results, but it hangs.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by aarti parikh [ 07/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I added the ssl options and now this works for the `ping` requests but fails for mongo_cursor calls. I no longer get the `Server closed connection. calling ismaster` but I am still seeing
when I try to iterate through a cursor. I am running the standard example code to print all documents in a collection. http://mongoc.org/libmongoc/current/cursors.html When running through the debugger this fails with a mongoc_cursor_error
Note: The same code to print documents work with a client that does not use a pool. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Hannes Magnusson [ 07/May/17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It looks like mongoc_client_pool_t is somehow not picking up the ssl setting from the connection uri. Adding a call to mongoc_client_pool_set_ssl_opts will explicitly tell the pool to use ssl.
Can you confirm that this workaround works for you aleksandr9809@gmail.com, aarti |