-
Notifications
You must be signed in to change notification settings - Fork 19
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
ARSN-370: fix memory leak in MongoDBReadStreams #2177
ARSN-370: fix memory leak in MongoDBReadStreams #2177
Conversation
Hello williamlardier,My role is to assist you with the merge of this Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
b7226d3
to
6aaace5
Compare
Codecov Report
@@ Coverage Diff @@
## development/8.1 #2177 +/- ##
===================================================
+ Coverage 64.28% 64.34% +0.05%
===================================================
Files 210 210
Lines 16381 16391 +10
Branches 3320 3320
===================================================
+ Hits 10531 10547 +16
+ Misses 5835 5829 -6
Partials 15 15
|
6aaace5
to
aabbdc1
Compare
@@ -1736,10 +1743,14 @@ class MongoClientInterface { | |||
}; | |||
log.error( | |||
'internalListObjectV1: error listing objects', logObj); | |||
// call explicitly the destroy method to clean the mongodb cursor | |||
stream.destroy(); |
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.
is this call not duplicated: e.g. will end
not be called on error
as well?
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.
No, and actually it's not even called in the v1 case due to the piping. See 4aa8b5c
if I remove the line, the test would fail because the stream was not properly cleaned.
@@ -477,6 +479,25 @@ describe('MongoClientInterface::metadata.listObject', () => { | |||
}), | |||
], done); | |||
}); | |||
|
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.
can we add a test for the "error" case as well?
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.
Done in 4aa8b5c
aabbdc1
to
1cb6cb8
Compare
The MongoDBReadStreams are not properly destroyed in both the Bucket V1 and V0 cases. In the V1 case, only the pipe-ed stream, the Transform one, is cleaned. In the V0 case, we directly call the callback without properly cleaning the stream, leaving open, in both cases, the mongodb cursors, that in turn affect the mongos memory consumption.
1cb6cb8
to
17b5bbc
Compare
/approve |
In the queueThe changeset has received all authorizations and has been added to the The changeset will be merged in:
The following branches will NOT be impacted:
There is no action required on your side. You will be notified here once IMPORTANT Please do not attempt to modify this pull request.
If you need this pull request to be removed from the queue, please contact a The following options are set: approve |
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
Please check the status of the associated issue ARSN-370. Goodbye williamlardier. |
The MongoDBReadStreams are not properly destroyed in both the Bucket V1 and V0 cases. In the V1 case, only the pipe-ed stream, the Transform one, is cleaned. In the V0 case, we directly call the callback without properly cleaning the stream, leaving open, in both cases, the mongodb cursors, that in turn affect the mongos memory consumption.
The fix was tested end2end:
Before (with k8s memory limits, otherwise it uses up to 100% of the cluster RAM):
Causing heap overflows in cloudserver pods and high MongoS memory usage due to open cursors.
After: