-
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
fix(NODE-5993): memory leak in the Connection
class
#4022
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nbbeeken
force-pushed
the
NODE-5993-mem-leak
branch
6 times, most recently
from
March 6, 2024 22:46
a8b3540
to
cefa58f
Compare
nbbeeken
commented
Mar 6, 2024
addaleax
previously approved these changes
Mar 7, 2024
nbbeeken
force-pushed
the
NODE-5993-mem-leak
branch
from
March 7, 2024 15:36
716c584
to
3ab0508
Compare
baileympearson
requested changes
Mar 7, 2024
baileympearson
approved these changes
Mar 7, 2024
baileympearson
changed the title
fix(NODE-5993): connection aborted promise leak
fix(NODE-5993): memory leak in the Mar 7, 2024
Connection
class
aditi-khare-mongoDB
added a commit
that referenced
this pull request
Mar 8, 2024
synced new test files added support for error response added api docs made MongoServerError.errorResponse required + casted resulting type errors test(NODE-5992): fix env var restoration in tests (#4017) refactor(NODE-5903): add newline to stdio logging (#4018) fix(NODE-5985): throw Nodejs' certificate expired error when TLS fails to connect instead of `CERT_HAS_EXPIRED` (#4014) test(NODE-5962): gossip cluster time in utr (#4019) chore(NODE-5997): update saslprep to ^1.1.5 (#4023) feat(NODE-5968): container and Kubernetes awareness in client metadata (#4005) fix(NODE-5993): memory leak in the `Connection` class (#4022) added TODO(NODE-XXXX)
This was referenced Jun 29, 2024
This was referenced Jul 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
What is changing?
Is there new documentation needed for these changes?
What is the motivation for this change?
The Connection class stored a promise that would reject when the signal was aborted. This caused a leak that would create new promises unbounded. I've removed the promise wrapping opting for a simpler implementation that only makes writing async if there was buffering. If there was buffering we wait for the drain event and use try/finally to make sure we clean up event listeners.
Release Highlight
Fixed memory leak in Connection layer
The Connection class has recently been refactored to operate on our socket operations using promises. An oversight how we made async network operations interruptible made new promises for every operation. We've simplified the approach and corrected the leak.
Double check the following
npm run check:lint
scripttype(NODE-xxxx)[!]: description
feat(NODE-1234)!: rewriting everything in coffeescript