[COMPASS-4527] Multiple mongos connections Created: 04/Dec/20  Updated: 29/Oct/23  Resolved: 17/Mar/22

Status: Closed
Project: Compass
Component/s: Connectivity
Affects Version/s: None
Fix Version/s: 1.31.0

Type: Investigation Priority: Major - P3
Reporter: Adamo Tonete (Inactive) Assignee: Felicia Hsieh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
is caused by SERVER-61585 Mongosh triggering an okta 2fa on eve... Open
Related
related to COMPASS-5617 Add srvMaxHosts in the list of URL op... Closed
is related to COMPASS-7009 Frequent "Connection pool cleared" error Open
Documentation Changes: Not Needed

 Description   

Problem Description

When connecting to a mongodb+srv that contains multiple mongos Compass is attempting to connect to all the members of the _mongodb._tcp hosts.
For some users that uses 2 factor authentication such as Okta, every connection to a mongodb+srv will prompt confirmation for all hosts (as they don't share the same ip)

Steps to Reproduce

Setup a shard with 4 mongos and attempt to connect using Compass client. It will open one connection for each mongos.

The same is not true for our mongo shell client, the shell client will only connect to one mongos instead.

Expected Results

We expect Compass to only perform authentication in one mongos instead of in all.

Actual Results

Compass opens connections to all the mongos and perform authentication in all of those

Additional Notes

The same is true for non LDAP authentication, however only users with LDAP configured to two factor authentication are affected.

The current workaround is specifying a single mongos in the connection uri ignoring the srv dns.



 Comments   
Comment by Anna Henningsen [ 17/Mar/22 ]

massimiliano.marcon felicia.hsieh Actually, srvMaxHosts (or a combination with maxPoolSize) might be better – it was specifically introduced to solve the problem described here.

Comment by Massimiliano Marcon [ 17/Mar/22 ]

With Compass 1.31 users can set the maxPoolSize to 1. Performance won't be great, but that's the best we can do on the Compass side.

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