Skip to content

Commit

Permalink
neard: handle SIGINT by stopping the node (#4449)
Browse files Browse the repository at this point in the history
Stop the system once a SIGINT is received.  This should allow for
graceful termination since System::stop will stop all the arbiters
and that in turn will stop all the actors (leading them through
stopping and stopped states thus allowing all the necessary cleanups).

To achieve this, also update uptade wasmer-runtime-core dependency to
0.17.4.  Among other things, the new version no longer catches the INT
signal making it available for tokie to handle.

Issue: #3266
  • Loading branch information
mina86 authored Jul 5, 2021
1 parent ac9694a commit 168d487
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions neard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tracing-subscriber = "0.2.4"
openssl-probe = "0.1.2"
near-rust-allocator-proxy = { version = "0.2.8", optional = true }
lazy_static = "1.4"
tokio = "1.1"

nearcore = { path = "../nearcore" }
near-primitives = { path = "../core/primitives" }
Expand Down
3 changes: 3 additions & 0 deletions neard/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ impl RunCmd {
let sys = actix::System::new();
sys.block_on(async move {
nearcore::start_with_config(home_dir, near_config);
tokio::signal::ctrl_c().await.unwrap();
info!("Got Ctrl+C, stopping");
actix::System::current().stop();
});
sys.run().unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/near-vm-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ borsh = "0.8.1"
serde = { version = "1", features = ["derive"] }
wasmer-runtime = { version="0.17.1", features = ["default-backend-singlepass"], default-features = false, package = "wasmer-runtime-near", optional = true }
# Always used even for wasmer 1.0 for validating wasm, will be replaced when refactor prepare.rs
wasmer-runtime-core = {version = "0.17.3", package = "wasmer-runtime-core-near" }
wasmer-runtime-core = {version = "0.17.4", package = "wasmer-runtime-core-near" }
wasmer = { version = "1.0.2", optional = true }
wasmer-types = { version = "1.0.2", optional = true }
wasmer-compiler-singlepass = { version = "1.0.2", optional = true, default-features = false, features = ["std", "enable-serde"] } # disable `rayon` feature.
Expand Down

0 comments on commit 168d487

Please sign in to comment.