You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "zhaizhibo (via GitHub)" <gi...@apache.org> on 2026/05/14 17:28:58 UTC

[PR] [BUG] Fix Condition.signalAll called without holding lock. [pulsar]

zhaizhibo opened a new pull request, #25777:
URL: https://github.com/apache/pulsar/pull/25777

   ### Motivation
   
   In `PulsarService.closeAsync()`, the `closeFuture.handle()` callback calls `isClosedCondition.signalAll()` without acquiring the associated mutex lock. 
   
   ### Modifications
   
   * Fix: Wrap isClosedCondition.signalAll() inside mutex.lock()/unlock() in the closeFuture.handle() callback.
   * Test: Add `testWaitUntilClosedConcurrentWithCloseAsync` in `PulsarServiceCloseTest` that calls `waitUntilClosed()` concurrently with `closeAsync()`. 
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [BUG] Fix Condition.signalAll called without holding lock. [pulsar]

Posted by "zhaizhibo (via GitHub)" <gi...@apache.org>.
zhaizhibo commented on PR #25777:
URL: https://github.com/apache/pulsar/pull/25777#issuecomment-4455770625

   @merlimat Fixed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][broker] Fix PulsarService.closeAsync where Condition.signalAll was called without holding a lock [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #25777:
URL: https://github.com/apache/pulsar/pull/25777


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [BUG] Fix Condition.signalAll called without holding lock. [pulsar]

Posted by "merlimat (via GitHub)" <gi...@apache.org>.
merlimat commented on code in PR #25777:
URL: https://github.com/apache/pulsar/pull/25777#discussion_r3244085775


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:
##########
@@ -755,7 +755,12 @@ public CompletableFuture<Void> closeAsync(boolean waitForWebServiceToStop) {
                     log.warn().exception(t).log("Closed with errors");
                 }
                 state = State.Closed;
-                isClosedCondition.signalAll();
+                mutex.lock();

Review Comment:
   I'd actually move the lock one line earlier to include the state change



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org