Skip to content

[fix][broker] Fix PulsarService.closeAsync where Condition.signalAll was called without holding a lock#25777

Merged
lhotari merged 3 commits into
apache:masterfrom
zhaizhibo:fix_broker_close
May 15, 2026
Merged

[fix][broker] Fix PulsarService.closeAsync where Condition.signalAll was called without holding a lock#25777
lhotari merged 3 commits into
apache:masterfrom
zhaizhibo:fix_broker_close

Conversation

@zhaizhibo
Copy link
Copy Markdown
Contributor

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().

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

@zhaizhibo
Copy link
Copy Markdown
Contributor Author

@merlimat Fixed.

@zhaizhibo zhaizhibo requested a review from merlimat May 15, 2026 00:19
@dao-jun dao-jun added area/broker type/bug The PR fixed a bug or issue reported a bug ready-to-test labels May 15, 2026
@lhotari lhotari changed the title [BUG] Fix Condition.signalAll called without holding lock. [fix][broker] Fix PulsarService.closeAsync where Condition.signalAll was called without holding a lock May 15, 2026
@lhotari lhotari added this to the 5.0.0-M1 milestone May 15, 2026
Copy link
Copy Markdown
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, good catch! This explains some flakiness that has been related to PulsarService.closeAsync in tests.

@lhotari lhotari merged commit a200088 into apache:master May 15, 2026
44 checks passed
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.

5 participants