-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
The problem of two exception handling #12744
The problem of two exception handling #12744
Conversation
Do you have any error/stacktrace to demonstrate your case? |
@eolivelli I encountered this problem when writing the offload of Transaction. Because there may be data that does not need to be transferred during offload, there may be holes when it is read out. In this regard, our processing is to return a NoSuchEntryException. Then we encountered this situation.Thanks to the help from @congbobo184 , this problem can be discovered. |
* up/master: Update deploy-bare-metal.md (apache#12432) [Broker] Fix producer getting incorrectly removed from topic's producers map (apache#12846) Add error log when new jetty client (apache#12840) JavaInstanceTest should be AssertEquals (apache#12836) [Transaction] Fix transaction flaky test testMaxReadPositionForNormalPublish (apache#12681) The problem of two exception handling (apache#12744) Fix TopicPoliciesCacheNotInitException issue. (apache#12773) Added local filesystem backend for package manager (apache#12708) [Java Client] Make userProvidedProducerName final (apache#12849) optimize indention in ServerCnx#handleProducer (apache#12854)
* up/master: [Issue 12757][broker] add broker config isAllowAutoUpdateSchema (apache#12786) Update deploy-bare-metal.md (apache#12432) [Broker] Fix producer getting incorrectly removed from topic's producers map (apache#12846) Add error log when new jetty client (apache#12840) JavaInstanceTest should be AssertEquals (apache#12836) [Transaction] Fix transaction flaky test testMaxReadPositionForNormalPublish (apache#12681) The problem of two exception handling (apache#12744) Fix TopicPoliciesCacheNotInitException issue. (apache#12773) Added local filesystem backend for package manager (apache#12708)
@merlimat Are you ok with this change? |
@congbobo184 This PR was reviewed and merged only by you. On the other hand, our contributing guidelines state that each PR must be approved by at least 2 Pulsar committers. |
@liangyepianzhou @congbobo184 I think the PR solves the problem but it has a regression. The Instead, I'd suggest to keep the exceptionally() part and convert the Eg: CompletableFuture<Void> f;
doSomething()
.thenAccept(res -> {
//// Potentially throw exception
f.complete(..);
}).exceptionally(ex -> {
f.completeExceptionally(ex);
return null;
}); |
Fixes #12744 ### Motivation The exception here was handled twice, resulting in a null pointer exception. And the position will be updated twice. ### Modifications Keep the exceptionally() part and convert the whenComplete() into thenAccept().
whenCompleteAsync has handle exception, don't use exceptionally, otherwise it will be handle twice
Fixes apache#12744 ### Motivation The exception here was handled twice, resulting in a null pointer exception. And the position will be updated twice. ### Modifications Keep the exceptionally() part and convert the whenComplete() into thenAccept().
whenCompleteAsync has handle exception, don't use exceptionally, otherwise it will be handle twice
Fixes apache#12744 ### Motivation The exception here was handled twice, resulting in a null pointer exception. And the position will be updated twice. ### Modifications Keep the exceptionally() part and convert the whenComplete() into thenAccept().
whenCompleteAsync has handle exception, don't use exceptionally, otherwise it will be handle twice
Fixes apache#12744 ### Motivation The exception here was handled twice, resulting in a null pointer exception. And the position will be updated twice. ### Modifications Keep the exceptionally() part and convert the whenComplete() into thenAccept().
whenCompleteAsync has handle exception, don't use exceptionally, otherwise it will be handle twice (cherry picked from commit fc8d50e)
Motivation
The exception here was handled twice, resulting in a null pointer exception.
And the position will be updated twice.
Modifications
Remove
exceptionally
in this case.Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
no-need-doc