Skip to content
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

[Issue #5176][pulsar-broker] Fix bug that fails to search namespace bundle due to NPE #5191

Merged
merged 1 commit into from
Sep 15, 2019

Conversation

massakam
Copy link
Contributor

Fixes #5176

Motivation

As mentioned in #5176, NPE may occur in the load manager and fail to search for namespace bundles. This is because multiple threads may update a map named brokerToNamespaceToBundleRange at the same time.

Modifications

  • Changed brokerToNamespaceToBundleRange to ConcurrentOpenHashMap instead of HashMap which is not thread safe.
  • Fixed LoadManagerShared.removeMostServicingBrokersForNamespace() logic so that NPE does not occur.

@massakam massakam added type/bug The PR fixed a bug or issue reported a bug area/broker labels Sep 13, 2019
@massakam massakam added this to the 2.4.2 milestone Sep 13, 2019
@massakam massakam self-assigned this Sep 13, 2019
Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jiazhai
Copy link
Member

jiazhai commented Sep 14, 2019

run java8 tests
run integration tests

@massakam
Copy link
Contributor Author

rerun java8 tests

2 similar comments
@massakam
Copy link
Contributor Author

rerun java8 tests

@massakam
Copy link
Contributor Author

rerun java8 tests

@jiazhai jiazhai merged commit 412c8fd into apache:master Sep 15, 2019
@massakam massakam deleted the fix-load-manager-npe branch September 15, 2019 15:36
wolfstudy pushed a commit that referenced this pull request Nov 20, 2019
Fixes #5176

### Motivation

As mentioned in #5176, NPE may occur in the load manager and fail to search for namespace bundles. This is because multiple threads may update a map named `brokerToNamespaceToBundleRange` at the same time.

### Modifications

- Changed `brokerToNamespaceToBundleRange` to ConcurrentOpenHashMap instead of HashMap which is not thread safe.
- Fixed `LoadManagerShared.removeMostServicingBrokersForNamespace()` logic so that NPE does not occur.

(cherry picked from commit 412c8fd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE occurs while searching for namespace bundle
3 participants