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: add exception handling for main tasks #2032

Merged
merged 3 commits into from
May 23, 2024

Conversation

canepat
Copy link
Member

@canepat canepat commented May 22, 2024

This PR introduces some additional exception handling in the following modules of sentry:

  • run loop of all the Sentry main tasks (i.e. StatusManager, Discovery...): these are long-running tasks which usually should never terminate (unless the user requests a graceful exit), so here we just catch any system exception to log a critical error and relaunch it. As a result, we will see what is the root cause of the error forcing the program to exit, currently it's just a somewhat obscure co_await: operation cancelled error
  • rlpx::Peer: during some tests I've found that sometimes a std::nested_exception gets raised, which we can handle properly. Moreover, I've seen Peer::post_message rarely failing to spawn Peer::send_message, thus causing the program to terminate, so I've added a warning to at least detect this situation (it seems to me like an unavoidable race between peer close and message spawing in different sub-tasks) and avoid program termination
  • rlpx:: Server: again, sometimes async_accept raises a boost::system::system_error with error code boost::system::errc::invalid_argument, which we need to understand but seems to self-heal in some way

@canepat canepat added the maintenance Some maintenance work (fix, refactor, rename, test...) label May 22, 2024
@canepat canepat requested a review from battlmonstr May 22, 2024 20:28
@battlmonstr battlmonstr merged commit 8415d10 into master May 23, 2024
4 checks passed
@battlmonstr battlmonstr deleted the sentry_task_exception_handling branch May 23, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Some maintenance work (fix, refactor, rename, test...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants