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

docs(NODE-6223): timeoutMS does not govern auto-connect #4280

Merged
merged 10 commits into from
Oct 23, 2024

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Oct 15, 2024

Description

What is changing?

Added docs

Is there new documentation needed for these changes?

New docs for docs? interesting idea

What is the motivation for this change?

Auto connect or plain connect performs file system access, DNS lookup, monitor creation, mongocryptd launching, and more! each one of these steps has its own mechanism for cancellation that is not considered by the CSOT spec. Alternatively we considered ignoring cancelling those operations and simply racing with a timeout, however, the impact could be squashing important errors.

Auto connect needs a future rework to better align with the drivers "always connected" perspective, for now, its best to explicitly connect if there's concern that the connecting operation won't complete in a globally set timeoutMS value.

Q&A

Is there anything that the user can set that will bound the execution time of autoconnect in this case?

Nothing specific to auto-connect, any client options: socketTimeoutMS, waitQueueTimeoutMS, serverSelectionTimeoutMS, connectTimeoutMS are all general options that control those components of the driver for all operations. Auto-connect or just connect itself has its own set of operations that cannot be timed out at all, reading TLS files, SRV/TXT DNS lookup, monitoring start-up, server selection, and a ping. Also, auto-encryption can have an internal client that repeats the aforementioned as well.

Generally, folks observe a MongoServerSelectionError when the ping forces a server selection that the monitors fail to service in time. That cannot be set for only connect and only covers a common case.

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@nbbeeken nbbeeken marked this pull request as draft October 15, 2024 17:56
@nbbeeken nbbeeken marked this pull request as ready for review October 15, 2024 18:18
@nbbeeken
Copy link
Contributor Author

Happy to take the tests out or adjust them, they were left over from when I started to implement connect timeout.

test/integration/node-specific/auto_connect.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/auto_connect.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/auto_connect.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/auto_connect.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/auto_connect.test.ts Outdated Show resolved Hide resolved
src/mongo_client.ts Outdated Show resolved Hide resolved
src/mongo_client.ts Outdated Show resolved Hide resolved
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Oct 16, 2024
@aditi-khare-mongoDB aditi-khare-mongoDB added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Oct 16, 2024
src/mongo_client.ts Outdated Show resolved Hide resolved
src/mongo_client.ts Outdated Show resolved Hide resolved
src/mongo_client.ts Show resolved Hide resolved
src/mongo_client.ts Outdated Show resolved Hide resolved
src/mongo_client.ts Outdated Show resolved Hide resolved
src/mongo_client.ts Outdated Show resolved Hide resolved
@nbbeeken nbbeeken force-pushed the NODE-6223-csot-connect branch from 69f042e to f38430b Compare October 22, 2024 17:34
@aditi-khare-mongoDB aditi-khare-mongoDB merged commit 17649e1 into NODE-6090 Oct 23, 2024
18 of 27 checks passed
@aditi-khare-mongoDB aditi-khare-mongoDB deleted the NODE-6223-csot-connect branch October 23, 2024 21:50
nbbeeken added a commit that referenced this pull request Nov 1, 2024
nbbeeken added a commit that referenced this pull request Nov 5, 2024
dariakp added a commit that referenced this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants