Skip to content

Fix memory leak in NodeTaskMap#15856

Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom
mayankgarg1990:fix_memory_leak
Mar 22, 2021
Merged

Fix memory leak in NodeTaskMap#15856
tdcmeehan merged 1 commit intoprestodb:masterfrom
mayankgarg1990:fix_memory_leak

Conversation

@mayankgarg1990
Copy link
Copy Markdown

This fixes a leak introduced recently in 26a373c. memoryUsageTracker and cpuUtilizationPercentageTracker
were being passed as both the referrant and as a part of the cleanup function. This caused 2 references to
these objects - one from the FinalizerService#finalizers and FinalizerService#FinalizeReference#cleanup
and prevented a cleanup.

Fixing this to just pass all 3 cleanups in a single function along with the NodeStatsTracker object.

Test plan - Using a heapdump I could now ensure that entries were indeed being cleaned up

== RELEASE NOTES ==

General Changes
* Fix a memory leak in `NodeTaskMap` which could lead to Full GC or OOMs in coordinator

Copy link
Copy Markdown
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayankgarg1990 Thanks for tracking down and fixing this issue. CC: @bhhari

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps, add a comment explaining that this cannot be broken down into 3 separate finalizers as this is non-obvious

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the necessary comment

This fixes a leak introduced recently in 26a373c. `memoryUsageTracker` and `cpuUtilizationPercentageTracker`
were being passed as both the referrant and as a part of the cleanup function. This caused 2 references to
these objects - one from the `FinalizerService#finalizers` and `FinalizerService#FinalizeReference#cleanup`
and prevented a cleanup.

Fixing this to just pass all 3 cleanups in a single function along with the `NodeStatsTracker` object.
@tdcmeehan
Copy link
Copy Markdown
Contributor

Great catch. Thank you @mayankgarg1990

@tdcmeehan tdcmeehan merged commit 2352b8d into prestodb:master Mar 22, 2021
@varungajjala varungajjala mentioned this pull request Mar 23, 2021
6 tasks
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 this pull request may close these issues.

3 participants