Skip to content

[improve][broker] Add UncaughtExceptionHandler for every thread pool - #18211

Merged
codelipenghui merged 2 commits into
apache:masterfrom
315157973:thread
Oct 27, 2022
Merged

codelipenghui merged 2 commits into
apache:masterfrom
315157973:thread

Conversation

@315157973

@315157973 315157973 commented Oct 26, 2022 •

Copy link
Copy Markdown
Contributor

Motivation

The current thread pool does not set UncaughtExceptionHandler, so the uncaught exception will disappear directly. Many times these unknown exceptions lead to unexpected bugs, such as locks not being released, etc. We need to print out these unknown exceptions for troubleshooting.

Modifications

In ExtendedThreadFactory, set UncaughtExceptionHandler and make it to be the default factory of every thread pool

Verifying this change

Make sure this setting does not affect existing unit tests passing
315157973#2

  • doc-not-needed

@315157973 315157973 self-assigned this Oct 26, 2022
@315157973 315157973 closed this Oct 26, 2022
@315157973 315157973 reopened this Oct 26, 2022
@315157973 315157973 changed the title [feat] Add UncaughtExceptionHandler for every thread pool [feat] [broker] Add UncaughtExceptionHandler for every thread pool Oct 26, 2022
@315157973 315157973 changed the title [feat] [broker] Add UncaughtExceptionHandler for every thread pool [feat][broker] Add UncaughtExceptionHandler for every thread pool Oct 26, 2022
@315157973 315157973 changed the title [feat][broker] Add UncaughtExceptionHandler for every thread pool [improve][broker] Add UncaughtExceptionHandler for every thread pool Oct 26, 2022
@github-actions

Copy link
Copy Markdown

@315157973 Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@codelipenghui codelipenghui added this to the 2.12.0 milestone Oct 27, 2022
@codelipenghui codelipenghui added release/2.9.4 release/2.11.1 release/2.10.3 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/broker doc-not-needed Your PR changes do not impact docs ready-to-test and removed doc-label-missing labels Oct 27, 2022
@codelipenghui codelipenghui reopened this Oct 27, 2022
@github-actions github-actions Bot added doc-label-missing and removed doc-not-needed Your PR changes do not impact docs labels Oct 27, 2022
@codecov-commenter

codecov-commenter commented Oct 27, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #18211 (524eb08) into master (6c65ca0) will increase coverage by 11.00%.
The diff coverage is 72.80%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #18211       +/-   ##
=============================================
+ Coverage     34.91%   45.91%   +11.00%     
- Complexity     5707    17654    +11947     
=============================================
  Files           607     1579      +972     
  Lines         53396   128707    +75311     
  Branches       5712    14151     +8439     
=============================================
+ Hits          18644    59099    +40455     
- Misses        32119    63508    +31389     
- Partials       2633     6100     +3467     
Flag Coverage Δ
unittests 45.91% <72.80%> (+11.00%) ⬆️

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

Impacted Files Coverage Δ
...org/apache/bookkeeper/mledger/LedgerOffloader.java 5.55% <ø> (ø)
...che/bookkeeper/mledger/LedgerOffloaderFactory.java 0.00% <ø> (ø)
...pache/bookkeeper/mledger/LedgerOffloaderStats.java 0.00% <ø> (ø)
...ookkeeper/mledger/LedgerOffloaderStatsDisable.java 0.00% <ø> (ø)
...a/org/apache/bookkeeper/mledger/ManagedCursor.java 85.71% <ø> (ø)
...che/bookkeeper/mledger/ManagedLedgerException.java 67.64% <ø> (ø)
...bookkeeper/mledger/ManagedLedgerFactoryConfig.java 86.66% <ø> (ø)
...g/apache/bookkeeper/mledger/ManagedLedgerInfo.java 77.77% <ø> (ø)
...he/bookkeeper/mledger/OffloadedLedgerMetadata.java 0.00% <ø> (ø)
...ava/org/apache/bookkeeper/mledger/ScanOutcome.java 100.00% <ø> (ø)
... and 1299 more

@github-actions github-actions Bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Oct 27, 2022
@codelipenghui
codelipenghui merged commit 5b7c5c6 into apache:master Oct 27, 2022
@congbobo184

Copy link
Copy Markdown
Contributor

could you please cherry-pick this PR to branch-2.9? thanks.

@congbobo184

Copy link
Copy Markdown
Contributor

@315157973 hi, I move this PR to release/2.9.5, if you have any questions, please ping me. thanks.

@liangyepianzhou

Copy link
Copy Markdown
Contributor

@315157973 Could you please open a PR to cherry-pick this to branch-2.10.
I am trying to do it, but there are a lot of conflicts.
I will move this PR to release 2.10.4. If you have any questions, please ping me.

liangyepianzhou pushed a commit that referenced this pull request Feb 25, 2023
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Feb 28, 2023
315157973 added a commit that referenced this pull request Mar 2, 2023
@coderzc coderzc added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Mar 2, 2023
Annavar-satish pushed a commit to pandio-com/pulsar that referenced this pull request Mar 6, 2023
liangyepianzhou added a commit that referenced this pull request Mar 11, 2023
…9779)

### Motivation
The original fix is #18268.
But after the fix is cherry-picked, the fix is overridden when resolving
conflicts for cherry-pick #18211.
### Modifications
Return the local thread variables in the `newThread`.
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Mar 29, 2023
…ache#19779)

### Motivation
The original fix is apache#18268.
But after the fix is cherry-picked, the fix is overridden when resolving
conflicts for cherry-pick apache#18211.
### Modifications
Return the local thread variables in the `newThread`.

(cherry picked from commit 240c22c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/broker cherry-picked/branch-2.9 Archived: 2.9 is end of life cherry-picked/branch-2.10 cherry-picked/branch-2.11 doc-not-needed Your PR changes do not impact docs ready-to-test release/2.9.5 release/2.10.4 release/2.11.1 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants