This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix graceful shutdown skipped if future ends with error #6769
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -229,10 +229,9 @@ impl<C: SubstrateCli> Runner<C> { | |||||
) -> Result<()> { | ||||||
self.print_node_infos(); | ||||||
let mut task_manager = initialise(self.config)?; | ||||||
self.tokio_runtime.block_on(main(task_manager.future().fuse())) | ||||||
.map_err(|e| e.to_string())?; | ||||||
let res = self.tokio_runtime.block_on(main(task_manager.future().fuse())); | ||||||
self.tokio_runtime.block_on(task_manager.clean_shutdown()); | ||||||
Ok(()) | ||||||
Ok(res.map_err(|e| e.to_string())?) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That doesn't work. I will a version with .into() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
} | ||||||
|
||||||
/// A helper function that runs a command with the configuration of this node | ||||||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a recurring question, but why do we even need a clean shut down? I've asked this question a couple times on Riot and nobody has ever given any answer.
It feels to me that someone one day has randomly put a line that waits for the shutdown, and nobody has ever dared remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TL;DR If we want to support any async runtime, we need to handle tasks cancelling.
All the details are here: #6642
There is also a link to the issue on async-std on the matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the question is more about why not just let the tasks be... If they are not cancelled, their objects are not properly dropped (Drop is not called).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue (that came from parity-ethereum) was rocksdb corruption on improper shutdown. Don't remember if it has happened in substrate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That rings a bell. Maybe @arkpar would have more info on that?