Skip to content

[Bug] ConcurrentBitSet is not thread safe #22360

@lhotari

Description

@lhotari

Search before asking

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

Version

ConcurrentBitSet was introduced in Pulsar 2.4.0

Minimal reproduce step

ConcurrentBitSet claims to be a multi-thread safe class.

There are several problems:

  • It contains invalid use of StampedLock class. It isn't using write lock, which makes the use of StampedLock useless.
  • Many used methods aren't handled. for example .clear() method.

ConcurrentBitSet.clear is called here:

What did you expect to see?

  • ConcurrentBitSet should properly use StampedLock
  • It should make most methods thread safe and prevent usage of other non-thread safe fields.

What did you see instead?

ConcurrentBitSet is not thread safe

Anything else?

This is related to issue #22352

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions