Skip to content
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

sentry: fix unhandled exception in peer handshake close #1897

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion silkworm/sentry/rlpx/peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ Task<void> Peer::handle() {
bool is_handshake_completed = false;
[[maybe_unused]] auto _ = gsl::finally([this, &is_handshake_completed] {
if (!is_handshake_completed) {
this->handshake_promise_.set_value(false);
try {
this->handshake_promise_.set_value(false);
} catch (const std::exception& e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what kind of exception is thrown and why?
is it possible to avoid a "catch all" and "ignore" here?

Copy link
Member Author

@canepat canepat Mar 11, 2024

Choose a reason for hiding this comment

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

It's a std::runtime_error we raise in AwaitableFuture::set when AsyncChannel::try_send returns false (i.e. not sent) and the channel is still open. We definitely can investigate this issue more and probably have a better fix, but I propose to do this in next PR on the subject.

Maybe we can keep #1896 open and you can put it on your todo list, if you agree.

log::Debug("sentry") << "Peer::handle finally exception: " << e.what();
}
}
this->close();
});
Expand Down
Loading