Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Assert acount hash mmap file capacity > 0 #33575

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

HaoranYi
Copy link
Contributor

@HaoranYi HaoranYi commented Oct 7, 2023

Problem

We are seeing a memory allocation failure when writing 0 to the end of
account's hash file.

It seems that it could be caused by self.capacity = 0. When we estimate the
capacity, it is possible that self.capacity = 0.

However, if write() is called, self.capacity must be greater than 0.

Summary of Changes

To rule out the possiblity, add an "assert" for capacity must be greater than
0.

Fixes #

Copy link
Contributor

@jeffwashington jeffwashington left a comment

Choose a reason for hiding this comment

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

lgtm

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #33575 (a9ac7c8) into master (7afb11f) will decrease coverage by 0.1%.
Report is 3 commits behind head on master.
The diff coverage is 100.0%.

@@            Coverage Diff            @@
##           master   #33575     +/-   ##
=========================================
- Coverage    81.7%    81.7%   -0.1%     
=========================================
  Files         807      807             
  Lines      218287   218288      +1     
=========================================
- Hits       178524   178482     -42     
- Misses      39763    39806     +43     

@HaoranYi HaoranYi merged commit 72574da into solana-labs:master Oct 9, 2023
@HaoranYi HaoranYi deleted the assert_capacity branch October 9, 2023 14:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants