From 5e9f9646d661117b9e536d32fcd15143fd028720 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Fri, 26 Apr 2024 02:08:09 +0900 Subject: [PATCH 1/3] kernel: switch back to honoring `OnExit::Restart` on crash --- kinode/src/kernel/process.rs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 31828ba0..85763235 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -607,7 +607,7 @@ pub async fn make_process_loop( }; // the process will run until it returns from init() or crashes - let is_error = match bindings + match bindings .call_init(&mut store, &metadata.our.to_string()) .await { @@ -618,7 +618,6 @@ pub async fn make_process_loop( content: format!("process {} returned without error", metadata.our.process), }) .await; - false } Err(_) => { let stderr = wasi_stderr.contents().into(); @@ -632,7 +631,6 @@ pub async fn make_process_loop( ), }) .await; - true } }; @@ -715,17 +713,6 @@ pub async fn make_process_loop( lazy_load_blob: None, }) .await?; - if is_error { - let _ = send_to_terminal - .send(t::Printout { - verbosity: 0, - content: format!( - "skipping OnExit::Restart for process {} due to crash", - metadata.our.process - ), - }) - .await; - } else { let _ = send_to_terminal .send(t::Printout { verbosity: 1, @@ -781,7 +768,6 @@ pub async fn make_process_loop( lazy_load_blob: None, }) .await?; - } } // if requests, fire them // even in death, a process can only message processes it has capabilities for From 55f8fc273b11a7453de4d14b32673f4be8f0911c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:08:36 +0000 Subject: [PATCH 2/3] Format Rust code using rustfmt --- kinode/src/kernel/process.rs | 110 +++++++++++++++++------------------ 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 85763235..463ed815 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -713,61 +713,61 @@ pub async fn make_process_loop( lazy_load_blob: None, }) .await?; - let _ = send_to_terminal - .send(t::Printout { - verbosity: 1, - content: format!( - "firing OnExit::Restart for process {}", - metadata.our.process - ), - }) - .await; - send_to_loop - .send(t::KernelMessage { - id: rand::random(), - source: our_kernel.clone(), - target: our_kernel.clone(), - rsvp: None, - message: t::Message::Request(t::Request { - inherit: false, - expects_response: None, - body: serde_json::to_vec(&t::KernelCommand::InitializeProcess { - id: metadata.our.process.clone(), - wasm_bytes_handle: metadata.wasm_bytes_handle, - wit_version: Some(metadata.wit_version), - on_exit: metadata.on_exit, - initial_capabilities, - public: metadata.public, - }) - .unwrap(), - metadata: None, - capabilities: vec![], - }), - lazy_load_blob: Some(t::LazyLoadBlob { - mime: None, - bytes: wasm_bytes, - }), - }) - .await?; - send_to_loop - .send(t::KernelMessage { - id: rand::random(), - source: our_kernel.clone(), - target: our_kernel.clone(), - rsvp: None, - message: t::Message::Request(t::Request { - inherit: false, - expects_response: None, - body: serde_json::to_vec(&t::KernelCommand::RunProcess( - metadata.our.process.clone(), - )) - .unwrap(), - metadata: None, - capabilities: vec![], - }), - lazy_load_blob: None, - }) - .await?; + let _ = send_to_terminal + .send(t::Printout { + verbosity: 1, + content: format!( + "firing OnExit::Restart for process {}", + metadata.our.process + ), + }) + .await; + send_to_loop + .send(t::KernelMessage { + id: rand::random(), + source: our_kernel.clone(), + target: our_kernel.clone(), + rsvp: None, + message: t::Message::Request(t::Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&t::KernelCommand::InitializeProcess { + id: metadata.our.process.clone(), + wasm_bytes_handle: metadata.wasm_bytes_handle, + wit_version: Some(metadata.wit_version), + on_exit: metadata.on_exit, + initial_capabilities, + public: metadata.public, + }) + .unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: Some(t::LazyLoadBlob { + mime: None, + bytes: wasm_bytes, + }), + }) + .await?; + send_to_loop + .send(t::KernelMessage { + id: rand::random(), + source: our_kernel.clone(), + target: our_kernel.clone(), + rsvp: None, + message: t::Message::Request(t::Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&t::KernelCommand::RunProcess( + metadata.our.process.clone(), + )) + .unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await?; } // if requests, fire them // even in death, a process can only message processes it has capabilities for From 5bc7a4eefac57543d68624c82b9a2671d73dc56f Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Fri, 26 Apr 2024 05:14:36 +0900 Subject: [PATCH 3/3] bump two deps --- kinode/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index 0776fa6b..1bb145a0 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -25,7 +25,7 @@ zip = "0.6" simulation-mode = [] [dependencies] -aes-gcm = "0.10.2" +aes-gcm = "0.10.3" alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4", features = ["ws"]} @@ -76,7 +76,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_urlencoded = "0.7" sha2 = "0.10" -snow = { version = "0.9.3", features = ["ring-resolver"] } +snow = { version = "0.9.5", features = ["ring-resolver"] } static_dir = "0.2.0" thiserror = "1.0" tokio = { version = "1.28", features = ["fs", "macros", "rt-multi-thread", "signal", "sync"] }