-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fix: bloomflex std::bad_alloc for large (2^32?) allocations
when using the fastidious option, swarm crashes when it tries to allocate the bloomfilter (at least for allocations of 5 GB, could also be the case for smaller allocations). Our current tests are not able to trigger this bug. I've introduced the bug on January 28th while replacing malloc with new and delete. Sadly, the bug is present in main branch and in the v3.1.1 release, so I think an urgent v3.1.2 release is necessary. Other replacements of malloc made in January may have introduced so-far undetected bugs. I will do my best to test large datasets before future releases.
- Loading branch information
1 parent
4d42123
commit a46bf32
Showing
3 changed files
with
29 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a46bf32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@torognes urgent bugfix! could you please make a v3.1.2 release?
a46bf32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can release a new version, but I think the bug is on line 78/79 in
bloomflex.cc
:The statement
b->bitmap = new uint64_t[size];
will allocate size * 8 bytes, since an uint64_t is 8 bytes long.While
b->bitmap = static_cast<uint64_t *>(xmalloc(size));
will allocate just size bytes.In effect, the code with
new
will allocate 8 times as much memory as needed, e.g. 5*8=40GB in the example, which may cause the crash if that amount of memory is not available.Would you like to try that, or should I release it as it is?
It could also be related to the memory alignment (16 bytes), but I doubt it.
BTW, the
bloompat.h
andbloompat.cc
files can be eliminated from the code. They are just an older version ofbloomflex.*
.a46bf32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your answer. I am in favor of making a bugfix release with the current version of the code.
Then, I can try to fix
b->bitmap = new uint64_t[size];
as you suggest, do extensive tests, and push to main if everything is correct. I would also like to review all thenew
-delete
changes I made in January.a46bf32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll go on and release it.