-
Notifications
You must be signed in to change notification settings - Fork 239
fix: memory leak in @elastic/elasticsearch instrumentation #2571
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
Conversation
This leak was introduced in #2484.
| const currSpan = ins.currSpan() | ||
| if (currSpan) { | ||
| diagResultFromSpan[currSpan] = result | ||
| diagResultFromSpan.set(currSpan, result) |
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.
:embarrassment:
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.
it got by my review too so sign me up for the :embarrassment: newsletter.
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.
Wow, that's a pitfall if I have ever seen one.
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.
Dynamic languages for you. Not sure if TypeScript would have caught this for me.
|
run module tests for @elastic/elasticsearch,@elastic/elasticsearch-canary |
astorm
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.
approved
| const currSpan = ins.currSpan() | ||
| if (currSpan) { | ||
| diagResultFromSpan[currSpan] = result | ||
| diagResultFromSpan.set(currSpan, result) |
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.
it got by my review too so sign me up for the :embarrassment: newsletter.
tl;dr: Use a WeakMap as a WeakMap, not as an Object.
This leak was introduced in #2484.
Fixes: #2569
Checklist