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.
If there has an exception, do we still need to do the tearDownWriteHandleState() and MetadataUpdateLoop operations?
There was a problem hiding this comment.
Yes, it still needs the following operations. Catch this exception just to ensure the closePromise can complete.
There was a problem hiding this comment.
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.
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.
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.
what about catching "Throwable" ?
|
@eolivelli Fixed, please check again. |
…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