Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][client] Fix deadlock of NegativeAcksTracker #23651

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

thetumbled
Copy link
Member

@thetumbled thetumbled commented Nov 28, 2024

Fixes #23650

Motivation

  • Consumer thread holding the lock of itself call NegativeAcksTracker.close, want to acquire NegativeAcksTracker's lock.
  • NegativeAcksTracker thread holding the lock of itself call NegativeAcksTracker.triggerRedelivery, want to acquire Consumer's lock.

Modifications

Reduce the scope of lock to avoid deadlock, that is release the lock of NegativeAcksTracker in NegativeAcksTracker.triggerRedelivery before acquire the lock of consumer.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: thetumbled#67

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@lhotari lhotari changed the title [fix][client] Fix deadlock of NegativeTracker. [fix][client] Fix deadlock of NegativeAcksTracker Nov 28, 2024
@lhotari lhotari added this to the 4.1.0 milestone Nov 28, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.34%. Comparing base (bbc6224) to head (a51d02c).
Report is 767 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23651      +/-   ##
============================================
+ Coverage     73.57%   74.34%   +0.77%     
- Complexity    32624    34996    +2372     
============================================
  Files          1877     1944      +67     
  Lines        139502   147240    +7738     
  Branches      15299    16250     +951     
============================================
+ Hits         102638   109472    +6834     
- Misses        28908    29318     +410     
- Partials       7956     8450     +494     
Flag Coverage Δ
inttests 27.20% <0.00%> (+2.62%) ⬆️
systests 24.29% <0.00%> (-0.04%) ⬇️
unittests 73.73% <100.00%> (+0.89%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...apache/pulsar/client/impl/NegativeAcksTracker.java 98.43% <100.00%> (+0.39%) ⬆️

... and 661 files with indirect coverage changes

@lhotari lhotari merged commit 68eb8f2 into apache:master Nov 28, 2024
67 of 70 checks passed
lhotari pushed a commit that referenced this pull request Nov 28, 2024
lhotari pushed a commit that referenced this pull request Nov 28, 2024
lhotari pushed a commit that referenced this pull request Nov 28, 2024
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 6, 2024
(cherry picked from commit 68eb8f2)
(cherry picked from commit 3a533af)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 9, 2024
(cherry picked from commit 68eb8f2)
(cherry picked from commit 3a533af)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Deadlock in NegativeAcksTracker.close
3 participants