RoaringBitmap / RoaringBitmap/CRoaring

Error reporting should be better

Open
#174 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
C
Stars
1.9k
Forks
334
Avg merge
2d 5h
Merged PRs (30d)
17

Description

Currently error handling is poor:

  • failure to allocate memory results in error message sent to stderr and segfault (e.g. in roaring_bitmap_add())
  • there is no way to distinguish between memory allocation errors and serialization format errors (portable_deserialize())

Both problems can be solved with integer error codes, e.g. 0 -- operation successful, -1 -- memory allocation error, -2 -- serialization format error, etc. Error codes should be returned for all operations which modify bitmaps.

There is, of course, an issue of atomicity. If error occurs inside some modification operation, bitmap can enter half-broken state. Atomicity guarantee would be too expensive from performance perspective. But we need to at least guarantee that bitmaps can be safely roaring_bitmap_free()d, even after an error. All other operations are UB.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining roaring_bitmap_add() and portable_deserialize(), then identify the other operations that modify bitmaps. Define integer error-code behavior for allocation and serialization failures, including the guarantee that roaring_bitmap_free() remains safe after an error. The issue explicitly permits non-atomic mutations, so document the resulting usage constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.