Skip to content

[Bug] Thread safety issues with topic policy mutations #21303

Open
@lhotari

Description

Search before asking

  • I searched in the issues and found nothing similar.

Version

Since 2.11

Minimal reproduce step

Topic policies are stored in system topics and stored as PulsarEvent instances which are serialized using Avro. The PulsarEvent can contain a TopicPoliciesEvent when it's eventType is TOPIC_POLICY. The TopicPoliciesEvent contains the TopicPolicies instance.

The problem is that TopicPolicies instances are cached and these cached instances are mutable in a non-thread safe way.

What did you expect to see?

TopicPolicies handling should be thread safe.

What did you see instead?

Thread safety concerns aren't covered in TopicPolicies.

Anything else?

There was a similar issue in mutating namespace policies, #9711. That was fixed with an approach where the shared instances are never mutated. The shared/cached instance is cloned and the clone is mutated.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Stalecategory/reliabilityThe function does not work properly in certain specific environments or failures. e.g. data losttype/bugThe PR fixed a bug or issue reported a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions