Repository navigation
Don't panic when background event processing fails - #1260
Open
ajaysehwal wants to merge 1 commit into
Open
ajaysehwal wants to merge 1 commit into
ajaysehwal wants to merge 1 commit into
Conversation
A failing background processor used to `panic!`, which aborted the host process or, for embedders that unwind, left a node that kept running without persisting anything. `Node::stop` then panicked again while holding the `is_running` write lock, poisoning it for all later calls. Have the background processor task return its result instead. On failure it now logs, signals the other background tasks to stop and disconnects all peers, so no further channel state changes happen. `wait_on_background_processor_task` reports a failed or panicked task as `Error::PersistenceFailed`, which `Node::stop` returns after marking the node as not running.
|
I've assigned @tnull as a reviewer! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the panic-on-background-processor-failure part of #381 (the "P0, easy" item in the discussion there).
Problem
If
process_events_asyncreturns an error (e.g. a persistence failure), the background processor task panicked:panic = "abort"(bindings, mobile) this aborts the host process.is_running, but nothing is persisted or handled anymore. A laterNode::stopthen hitspanic!("Stopping event handling failed...")while holding theis_runningwrite lock, which poisons the lock so every subsequent API call panics too.Changes
Resultinstead of panicking.Runtime::wait_on_background_processor_taskreturnsError::PersistenceFailedfor a failed or panicked task instead of panicking.Node::stopmarks the node as not running and returns that error.Node::startstill just winds down on a failed startup and reports the startup error.Not in this PR
status()), which needs a bigger design change.Ok, as before.Testing
Added unit tests in
runtime.rsfor a clean exit, a failed task and a panicking task.cargo test --lib runtime::passes. There is no end-to-end test with a failing store.