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

Fix: clear difflayer cache when truncate not triggered #141

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

krish-nr
Copy link
Contributor

Description

This PR aims to fix a potential memory leak issue in nodebuffer.

Rationale

In #121 we introduced a potential memory leak risk. When the block height difference between stateid and truncate tail in the differlayer exceeds the limit size (90,000), we attempt to trigger a truncate. However, to prevent repeated deletions, we added a condition. If the condition is not met, we do not perform the truncate and return directly, waiting until the next trigger. Before returning, we forgot to clear the difflayer cache, which causes the difflayer to be unrecoverable, resulting in a memory leak. The diagram shows the monitoring of this part of the memory (pathdb_difflayer_hashcache_size).

The metric shows the memory usage of difflayer before and after enabling this fix.

image

Example

N/A

Changes

Copy link
Contributor

@redhdx redhdx left a comment

Choose a reason for hiding this comment

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

LGTM

@owen-reorg owen-reorg merged commit 0effa90 into bnb-chain:develop Aug 20, 2024
2 checks passed
Copy link

@aweneagle aweneagle left a comment

Choose a reason for hiding this comment

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

LGTM

@krish-nr krish-nr deleted the fix_nodebuffer_oom branch August 20, 2024 02:48
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.

5 participants