Skip to content

proxy-client: tolerate exceptions from remote destroy during cleanup#273

Open
xyzconstant wants to merge 2 commits intobitcoin-core:masterfrom
xyzconstant:issue-219-noexcept-destroy
Open

proxy-client: tolerate exceptions from remote destroy during cleanup#273
xyzconstant wants to merge 2 commits intobitcoin-core:masterfrom
xyzconstant:issue-219-noexcept-destroy

Conversation

@xyzconstant
Copy link
Copy Markdown

Fixes #219.

Catches exceptions from Sub::destroy(*this) in ~ProxyClientBase's cleanup lambda so a failed remote destroy call doesn't crash the process. Regression test included.

Reproduces bitcoin-core#219 by saving a callback on
the server then disconnecting before cleanup completes, so the
server-side `~ProxyClient` runs its remote destroy call against a dead
connection.

Without the fix in the next commit, the throw escapes the noexcept
destructor and aborts mptest.
@DrahtBot
Copy link
Copy Markdown

DrahtBot commented Apr 22, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK ryanofsky

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Copy link
Copy Markdown
Collaborator

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK 6de92e1. Nice fix and test.

Similar to #260, I think it is reasonable to suppress and log exceptions here and better than the alternative of not handling them correctly. But I think the best thing to do would be to propagate the exceptions to callers.

In issue #219 the choice of whether to throw or suppress the error here is a little muddy because #219 is a case where a server object (handler) owns a client object (notifications), and the exception happens when the server object is being garbage collected and trying to delete the client object. In this case, since the error happens during garbage collection, there's not really anything for server to do better than logging the failure.

But after this change, all errors that happen when trying to destroy client objects will be suppressed, and that is probably not ideal. It's just better than the current behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SIGABRT in ~ProxyClientBase with #29409 and rust client

3 participants