-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Mongo clients with serverSelectionTimeoutMS
set to 5000
#13408
Conversation
serverSelectionTimeoutMS
serverSelectionTimeoutMS
set to 5000
if c.options.printFormat { | ||
return fmt.Sprintf(`"%s"`, address.String()) | ||
} | ||
return address.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to quote the connectionString to mitigate shell parsing errors ?
So instead of invoking mongosh mongodb://localhost:12345/mydb?serverSelectionTimeoutMS=5000
we should alywas call mongosh "mongodb://localhost:12345/mydb?serverSelectionTimeoutMS=5000"
even if TLS routing is disabled ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quoted URL will fail exec.Cmd.Run
as clients sees the quotation as invalid URL.
I tested this with Teleport Connect today and I've added WithPrintFormat
for it to make sure postgres and mongo connection urls are quoted. And also added some more comments on WithPrintFormat
I've also added @ravicious for review on that part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this on a Connect build and I managed to successfully connect to my mongo instance.
Thanks @ravicious for confirming =D |
fixes #13195
Testing:
tsh db connect
mongosh
: works as expected, can use the env var to test scenariosmongo
: connects fine with provided URL but never times out - I think the client is ignoring the parameter.tsh proxy db --tunnel
works as expectedNote:
This is a temporary solution that tries to resolve most situations. Further investigation will be conducted to find why
tsh db connect
takes very long.Another temporary workaround that can be done by the user is to downgrade to old
mongo
client instead of usingmongosh