Skip to content
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

Potential memory leak? #634

Closed
asos-VasilisKortsimelidis opened this issue May 22, 2020 · 2 comments · Fixed by #635
Closed

Potential memory leak? #634

asos-VasilisKortsimelidis opened this issue May 22, 2020 · 2 comments · Fixed by #635

Comments

@asos-VasilisKortsimelidis
Copy link

Hi App insights team,

I'm trying to identify a memory leak in one of our apps.

Please see the below screenshot

Screenshot 2020-05-22 at 16 21 04

Comparing the two memory dumps, seems that there are many closures being added to the memory from this line of code.

https://github.com/microsoft/ApplicationInsights-node.js/blob/develop/Library/Sender.ts#L138

setTimeout(() => this._sendFirstFileOnDisk(), this._resendInterval).unref();

Quickly commenting out that line of code seems to fix the problem.

What are your thoughts about this?

Thanks!

@markwolff
Copy link
Contributor

I think the current behavior is to create a new timer each time telemetry is accepted by the backend. By default, Only 4 of these timers should be created per minute (default batch interval is 15 seconds), and they should be cleared every _resendInterval, which is 1 minute. If you turn off batching, I would imagine they would pile up for each send and disappear after the minute passes.

All of the extra timers are redundant after the 1st one, and so I will make a change to not create new ones after the 1st

@asos-VasilisKortsimelidis
Copy link
Author

@markwolff Thanks for the quick response and your commit! I'm going to test it now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants