-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
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.
Some comments, but overall it looks good.
node/cli/src/lib.rs
Outdated
let _telemetry = service.telemetry(); | ||
drop(service); | ||
|
||
// TODO [andre]: timeout this future |
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.
Please make a github issue for this.
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.
Done.
node/cli/src/service.rs
Outdated
@@ -120,7 +109,7 @@ construct_service_factory! { | |||
grandpa::NetworkBridge::new(service.network()), | |||
)?; | |||
|
|||
executor.spawn(voter); | |||
executor.spawn(voter.select(service.on_exit()).then(|_| Ok(()))); |
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.
Can we not take the on_exit
as parameter for run_grandpa
? I think that makes it more easy to use and people who write their own node does not forget to select on exit.
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.
agreed. longer-term I would like a special executor that just applies the exit future to everything passed to it.
I spent a little time optimizing exit-future
yesterday so it should have minimal overhead now.
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.
I've updated the code according to your suggestions, but FWIW I think I prefer the original version because it's easier to check, we just make sure that all call-sites of spawn
are exit-guarded. I think longer-term we should go with @rphmeier's suggestion though.
node/cli/src/service.rs
Outdated
service.network(), | ||
); | ||
|
||
executor.spawn(aura.select(service.on_exit()).then(|_| Ok(()))); |
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.
Same here as below.
@andresilva, interesting! In theory it may be the real cause of #1036. Need to recheck that issue. |
* node: remove grandpa authority flags * node: exit-guard grandpa and aura spawned futures * node: wait for futures to stop running on shutdown * core: run connectivity tests on same ports * core: pass on_exit future when starting aura and grandpa * node: add issue number to todo * core: fix aura and grandpa tests
* node: remove grandpa authority flags * node: exit-guard grandpa and aura spawned futures * node: wait for futures to stop running on shutdown * core: run connectivity tests on same ports * core: pass on_exit future when starting aura and grandpa * node: add issue number to todo * core: fix aura and grandpa tests
* node: remove grandpa authority flags * node: exit-guard grandpa and aura spawned futures * node: wait for futures to stop running on shutdown * core: run connectivity tests on same ports * core: pass on_exit future when starting aura and grandpa * node: add issue number to todo * core: fix aura and grandpa tests
* node: remove grandpa authority flags * node: exit-guard grandpa and aura spawned futures * node: wait for futures to stop running on shutdown * core: run connectivity tests on same ports * core: pass on_exit future when starting aura and grandpa * node: add issue number to todo * core: fix aura and grandpa tests
* node: remove grandpa authority flags * node: exit-guard grandpa and aura spawned futures * node: wait for futures to stop running on shutdown * core: run connectivity tests on same ports * core: pass on_exit future when starting aura and grandpa * node: add issue number to todo * core: fix aura and grandpa tests
* node: remove grandpa authority flags * node: exit-guard grandpa and aura spawned futures * node: wait for futures to stop running on shutdown * core: run connectivity tests on same ports * core: pass on_exit future when starting aura and grandpa * node: add issue number to todo * core: fix aura and grandpa tests
Tokio doesn't run destructors for any futures still in the pool on shutdown. We blocked the tokio runtime on the outer exit future (triggered by ctrl-c), afterwards we would fire the exit signal but would not wait for all futures in the runtime to finish. Most significantly this can lead to database corruption since it isn't closed properly.
Now, after firing the exit signal we wait for the runtime to be idle, which means that all spawned futures must be guarded by the exit signal (aura and grandpa were missing).
Merge after #1306.
Fixes #1161, fixes #1034, fixes #1035.