Skip to content

[improve][broker] Added synchronized for sendMessages in Non-Persistent message dispatchers #24386

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
merged 1 commit into from
Jun 5, 2025

Conversation

sandeep-mst
Copy link
Contributor

Fixes #24379

Motivation

We have observed inconsistency with the usage of synchronized keyword while dispatching messages to the consumer across different dispatchers.
The following are not using synchronized keyword while filtering and sending messages to the consumers.

The rest of the dispatchers including all the persistent dispatchers and NonPersistentDispatcherMultipleConsumers use synchronized while sending messages. This causes inconsistencies across different dispatchers while running server-side filters with multiple producers and a single consumer as it will get multi-threaded. This is even more a case when server-side filter code is not thread-safe.

Modifications

Added synchronized keyword at the following two method calls.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

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:
cognitree#24

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jun 5, 2025
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
Copy link
Member

lhotari commented Jun 5, 2025

Thanks for fixing this issue @sandeep-mst

@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.24%. Comparing base (bbc6224) to head (71166c7).
Report is 1132 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24386      +/-   ##
============================================
+ Coverage     73.57%   74.24%   +0.67%     
+ Complexity    32624    32298     -326     
============================================
  Files          1877     1867      -10     
  Lines        139502   145267    +5765     
  Branches      15299    16610    +1311     
============================================
+ Hits         102638   107855    +5217     
+ Misses        28908    28870      -38     
- Partials       7956     8542     +586     
Flag Coverage Δ
inttests 26.75% <ø> (+2.16%) ⬆️
systests 23.32% <ø> (-1.00%) ⬇️
unittests 73.73% <ø> (+0.89%) ⬆️

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

Files with missing lines Coverage Δ
...t/NonPersistentDispatcherSingleActiveConsumer.java 87.50% <ø> (+0.40%) ⬆️
...ersistentStickyKeyDispatcherMultipleConsumers.java 75.28% <ø> (+5.01%) ⬆️

... and 1086 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dlg99 dlg99 merged commit cb0fe5b into apache:master Jun 5, 2025
190 of 204 checks passed
@sandeep-mst sandeep-mst deleted the dispatchers-24379 branch June 6, 2025 07:42
lhotari pushed a commit that referenced this pull request Jun 9, 2025
…nt message dispatchers (#24386)

(cherry picked from commit cb0fe5b)
lhotari pushed a commit that referenced this pull request Jun 9, 2025
…nt message dispatchers (#24386)

(cherry picked from commit cb0fe5b)
lhotari pushed a commit that referenced this pull request Jun 9, 2025
…nt message dispatchers (#24386)

(cherry picked from commit cb0fe5b)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 12, 2025
…nt message dispatchers (apache#24386)

(cherry picked from commit cb0fe5b)
(cherry picked from commit 7ed6edc)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 12, 2025
…nt message dispatchers (apache#24386)

(cherry picked from commit cb0fe5b)
(cherry picked from commit 31bae69)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 12, 2025
…nt message dispatchers (apache#24386)

(cherry picked from commit cb0fe5b)
(cherry picked from commit 7ed6edc)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 13, 2025
…nt message dispatchers (apache#24386)

(cherry picked from commit cb0fe5b)
(cherry picked from commit 7ed6edc)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 13, 2025
…nt message dispatchers (apache#24386)

(cherry picked from commit cb0fe5b)
(cherry picked from commit 31bae69)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 16, 2025
…nt message dispatchers (apache#24386)

(cherry picked from commit cb0fe5b)
(cherry picked from commit 7ed6edc)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 16, 2025
…nt message dispatchers (apache#24386)

(cherry picked from commit cb0fe5b)
(cherry picked from commit 31bae69)
nodece pushed a commit to nodece/pulsar that referenced this pull request Jun 18, 2025
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.

[Enhancement] Inconsistency across different message dispatchers while sending messages
4 participants