Skip to content

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

Merged
C0urante merged 3 commits intoapache: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 intoapache:trunkfrom
Kvicii:KAFKA-13971/thread_safe

Conversation

@Kvicii
Copy link
Copy Markdown
Contributor

@Kvicii Kvicii commented Jun 9, 2022

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
Copy link
Copy Markdown
Member

@divijvaidya divijvaidya left a comment

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
Copy link
Copy Markdown
Contributor Author

Kvicii commented Jun 20, 2022

@hachikuji can you help me review this PR?

@ijuma
Copy link
Copy Markdown
Member

ijuma commented Aug 10, 2022

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

Copy link
Copy Markdown
Contributor

@C0urante C0urante left a comment

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