Skip to content

fix(NODE-6151): MongoClient connect does not keep Node.js running #4101

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
May 6, 2024

Conversation

W-A-James
Copy link
Contributor

@W-A-James W-A-James commented May 6, 2024

Description

What is changing?

Is there new documentation needed for these changes?

What is the motivation for this change?

Release Highlight

ref()-ed timer keeps event loop running until client.connect() resolves

When the MongoClient is first starting up (client.connect()) monitoring connections begin the process of discovering servers to make them selectable. The ref()-ed serverSelectionTimeoutMS timer keeps Node.js' event loop running as the monitoring connections are created. In the last release we inadvertently unref()-ed this initial timer which would allow Node.js to close before the monitors could create connections.

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

@W-A-James W-A-James changed the title fix bug fix(NODE-6151): MongoClient connect does not keep Node.js running May 6, 2024
@W-A-James W-A-James marked this pull request as ready for review May 6, 2024 20:39
@nbbeeken nbbeeken merged commit 7e0d9e6 into main May 6, 2024
20 of 25 checks passed
@nbbeeken nbbeeken deleted the NODE-6151 branch May 6, 2024 21:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants