Skip to content

Fix deadlock for negative acknowledgment #266

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

Merged

Conversation

BewareMyPower
Copy link
Contributor

Fixes #265

Modifications

Make timer_ const and enabledForTesting_ atomic in NegativeAcksTracker so that the mutex_ can be used only for the nackedMessages_ field. After that, we can unlock mutex_ in handleTimer to avoid the potential deadlock from user-provided logger or intercepter.

Add ConsumerTest.testNegativeAckDeadlock to verify the fix.

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

Fixes apache#265

### Modifications

Make `timer_` const and `enabledForTesting_` atomic in
`NegativeAcksTracker` so that the `mutex_` can be used only for the
`nackedMessages_` field. After that, we can unlock `mutex_` in
`handleTimer` to avoid the potential deadlock from user-provided logger
or intercepter.

Add `ConsumerTest.testNegativeAckDeadlock` to verify the fix.
@BewareMyPower BewareMyPower merged commit 8a9b2dc into apache:main May 6, 2023
@BewareMyPower BewareMyPower deleted the bewaremypower/negative-ack-deadlock branch May 6, 2023 09:25
BewareMyPower added a commit that referenced this pull request May 6, 2023
Fixes #265

### Modifications

Make `timer_` const and `enabledForTesting_` atomic in
`NegativeAcksTracker` so that the `mutex_` can be used only for the
`nackedMessages_` field. After that, we can unlock `mutex_` in
`handleTimer` to avoid the potential deadlock from user-provided logger
or intercepter.

Add `ConsumerTest.testNegativeAckDeadlock` to verify the fix.

(cherry picked from commit 8a9b2dc)
BewareMyPower added a commit to BewareMyPower/pulsar-client-python that referenced this pull request May 17, 2023
Fixes apache#116

apache/pulsar-client-cpp#266 is included in the
C++ client 3.2.0 so that apache#116 will be fixed.
merlimat pushed a commit to apache/pulsar-client-python that referenced this pull request May 17, 2023
* Bump the C++ client to 3.2.0

Fixes #116

apache/pulsar-client-cpp#266 is included in the
C++ client 3.2.0 so that #116 will be fixed.

* Change the download URL since archive.apache.org is not available now

* Revert "Change the download URL since archive.apache.org is not available now"

This reverts commit 6b92e98.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Deadlock for negative acknowledgment
2 participants