-
Notifications
You must be signed in to change notification settings - Fork 963
Make sure the LedgerHandle close callback can be completed when encounter exception #2913
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
Make sure the LedgerHandle close callback can be completed when encounter exception #2913
Conversation
| try { | ||
| errorOutPendingAdds(rc, pendingAdds); | ||
| } catch (Exception e) { | ||
| closePromise.completeExceptionally(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there has an exception, do we still need to do the tearDownWriteHandleState() and MetadataUpdateLoop operations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it still needs the following operations. Catch this exception just to ensure the closePromise can complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't "completeExceptionally" or "complete" the closePromise twice
| try { | ||
| errorOutPendingAdds(rc, pendingAdds); | ||
| } catch (Exception e) { | ||
| closePromise.completeExceptionally(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it still needs the following operations. Catch this exception just to ensure the closePromise can complete.
| try { | ||
| errorOutPendingAdds(rc, pendingAdds); | ||
| } catch (Exception e) { | ||
| closePromise.completeExceptionally(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't "completeExceptionally" or "complete" the closePromise twice
| errorOutPendingAdds(rc, pendingAdds); | ||
| try { | ||
| errorOutPendingAdds(rc, pendingAdds); | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about catching "Throwable" ?
|
@eolivelli Fixed, please check again. |
StevenLuMT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
eolivelli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
…nter exception (apache#2913) * Make sure the LedgerHandle close callback can be completed when encounter exception. (cherry picked from commit 05ca058)
…nter exception (apache#2913) * Make sure the LedgerHandle close callback can be completed when encounter exception. (cherry picked from commit 05ca058)
…nter exception (apache#2913) * Make sure the LedgerHandle close callback can be completed when encounter exception. (cherry picked from commit 05ca058) (cherry picked from commit d8484b4)
…nter exception (apache#2913) * Make sure the LedgerHandle close callback can be completed when encounter exception.
Related to apache/pulsar#12993