Skip to content

KAFKA-13971:Atomicity violations caused by improper usage of ConcurrentHashMap#12277

Merged
C0urante merged 3 commits into
apache:trunkfrom
Kvicii:KAFKA-13971/thread_safe
Aug 17, 2022
Merged

KAFKA-13971:Atomicity violations caused by improper usage of ConcurrentHashMap#12277
C0urante merged 3 commits into
apache:trunkfrom
Kvicii:KAFKA-13971/thread_safe

Conversation

@Kvicii

@Kvicii Kvicii commented Jun 9, 2022

Copy link
Copy Markdown
Contributor

ensure thread safe

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@Kvicii Kvicii changed the title ensure thread safe KAFKA-13971:Atomicity violations caused by improper usage of ConcurrentHashMap Jun 9, 2022

@divijvaidya divijvaidya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the code as per the suggestion. LGTM!

@Kvicii

Kvicii commented Jun 20, 2022

Copy link
Copy Markdown
Contributor Author

@hachikuji can you help me review this PR?

@ijuma

ijuma commented Aug 10, 2022

Copy link
Copy Markdown
Member

We should check if this code is used in a concurrent context. Will leave it to @C0urante.

@C0urante C0urante left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unlikely but definitely possible for scheduleReload to be invoked concurrently, since tasks are allowed to access their own configs through their SourceTaskContext/SinkTaskContext.

I wish we could have a test for this but considering how tricky it is to reliably reproduce race conditions and how simple the changes are, I'm comfortable making an exception and merging this change without a unit test.

LGTM, thanks @Kvicii!

@C0urante
C0urante merged commit d8e93c3 into apache:trunk Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants