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 the OOM in log_server #1327

Merged
merged 3 commits into from
Jun 29, 2023
Merged

Fix the OOM in log_server #1327

merged 3 commits into from
Jun 29, 2023

Conversation

kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented Jun 26, 2023

As @shelvenzhou reported, the sidevm of the contract log_server panics due to OOM.
image
See #1325 for the misleading of the error message.

I've checked it with random test logs and didn't see memory leak in the sidevm program.

The size of logs was limited with a soft bound of 8MB. However, we under-estimated the current log size with a rough formula.
Counting in the overhead, the actual memory cost was far more than 8MB. And a large tmp memory blob is required when a query requests all log records. This could make the guest run out of memory.

This PR makes 2 improvements:

  • Using the metric reported from the memory allocator as the records size bounds. This should be more accurate than the estimated one before.
  • Boxing each single log record. This could reduce the overhead of the VecDeque container.

Copy link
Contributor

@h4x3rotab h4x3rotab left a comment

Choose a reason for hiding this comment

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

LGTM

@kvinwang kvinwang merged commit cef1fce into master Jun 29, 2023
@kvinwang kvinwang deleted the fix-logger-oom branch June 29, 2023 04:09
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.

2 participants