Skip to content

checkedRemove() can cause corruption in some cases when the bitmap is serialized/deserialized #801

@prashp

Description

@prashp

Describe the bug
We noticed that our bitmaps were getting corrupted from time to time. Appears like the issue is with RoaringBitmap.checkedRemove() method. In the method, sometimes an incorrect container in set and then when serialized/deserialized leads to corruption. Note that the Container.remove() can return a different Container sometimes which is being ignored by checkedRemove(). The RoaringBitmap.remove() method doesn't suffer from the same issue.

Here is a test case that reproduces the problem. The branch also has a potential fix for this issue:
master...prashp:RoaringBitmap:checked-remove-bug

To Reproduce
The reproducer is available in the above fork/branch. Run the CheckedRemoveTest to see the issue. It takes quite a few iterations to reproduce the issue. Usually reproduces under 15s in my environment.

RoaringBitmap version:
The issue can be reproduced on the master. We first noticed the issue on 1.2.1

Java version:

openjdk version "21.0.7"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions