Skip to content

[fix][broker] Fix PersistentMessageExpiryMonitor findEntryComplete() method may lose mark-delete properties in race condition#25803

Merged
lhotari merged 7 commits into
apache:masterfrom
oneby-wang:expiry_monitor_mark_delete_properties
May 25, 2026
Merged

[fix][broker] Fix PersistentMessageExpiryMonitor findEntryComplete() method may lose mark-delete properties in race condition#25803
lhotari merged 7 commits into
apache:masterfrom
oneby-wang:expiry_monitor_mark_delete_properties

Conversation

@oneby-wang

Copy link
Copy Markdown
Contributor

Motivation

This is a follow-up to #25165 and the same class of mark-delete properties race condition, covering PersistentMessageExpiryMonitor.findEntryComplete().

PersistentMessageExpiryMonitor.findEntryComplete() may lose mark-delete properties in a race condition.

When the expiry monitor advances a cursor while another markDelete() call with properties is in progress, passing the cursor current properties can capture stale properties and later overwrite the user-provided mark-delete properties.

Modifications

  1. Add testExpireMessagesNeverLoseMarkDeleteProperties() test to reproduce the issue.
  2. Pass null to asyncMarkDelete() method properties param in PersistentMessageExpiryMonitor.findEntryComplete(), so the cursor uses the latest properties when the mark-delete is applied.
  3. Run test to verify the code change.

Verifying this change

  • Make sure that the change passes the CI checks.

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: oneby-wang#33

@oneby-wang oneby-wang changed the title [fix][broker] Fix PersistentMessageExpiryMonitor may lose mark-delete properties in race condition [fix][broker] Fix PersistentMessageExpiryMonitor findEntryComplete() method may lose mark-delete properties in race condition May 18, 2026
@lhotari lhotari added this to the 5.0.0-M1 milestone May 25, 2026
@lhotari lhotari merged commit 47eec87 into apache:master May 25, 2026
43 checks passed
lhotari pushed a commit that referenced this pull request Jun 1, 2026
…method may lose mark-delete properties in race condition (#25803)

(cherry picked from commit 47eec87)
lhotari pushed a commit that referenced this pull request Jun 1, 2026
…method may lose mark-delete properties in race condition (#25803)

(cherry picked from commit 47eec87)
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 9, 2026
…method may lose mark-delete properties in race condition (apache#25803)

(cherry picked from commit 47eec87)
(cherry picked from commit a71f7e8)
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.

3 participants