-
-
Notifications
You must be signed in to change notification settings - Fork 4k
fix: clear timeout in collection operations to prevent memory leak #15852
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
base: master
Are you sure you want to change the base?
fix: clear timeout in collection operations to prevent memory leak #15852
Conversation
- Add clearTimeout() calls in success and error paths - Prevents setTimeout references from accumulating - Fixes memory leak in high-throughput applications - Add test to verify timeout cleanup behavior Fixes memory leak where buffered collection operations would create setTimeout timers that were never cleared when operations completed successfully, causing continuous memory growth.
vkarpov15
left a comment
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.
clearTimeout looks good but there's some unrelated changes that are incorrect
Keep only the setTimeout memory leak fix as requested by maintainers. Revert changes to connection.js that were unrelated to the timeout issue.
Move timeout variable declaration to function scope to ensure it's accessible in all success/error paths for proper cleanup.
- Add clearTimeout() calls in success/error paths to prevent memory leaks - Move timeout variable to function scope for proper cleanup access - Revert unrelated otherDbs/relatedDbs changes as requested by maintainer - Move tests to collection.test.js as requested
|
Hi @vkarpov15! Thank you for the detailed feedback. I've addressed all your comments: ✅ Reverted all unrelated otherDbs/relatedDbs changes in connection.js back to original implementation The PR is now focused and clean. I really appreciate your guidance and would love to get this memory leak fix MERGED! |
|
@vkarpov15 I have resolved all the issues and rechecked them please let me know if something is wrong or missing I will update it, and if it's not can you merge it please. |
Fixes memory leak where buffered collection operations would create setTimeout timers that were never cleared when operations completed successfully, causing continuous memory growth.
Summary
Examples