diff --git a/cmd/zfs_object_agent/Cargo.lock b/cmd/zfs_object_agent/Cargo.lock index f60fc60a5ad8..d9d1b2f15d2a 100644 --- a/cmd/zfs_object_agent/Cargo.lock +++ b/cmd/zfs_object_agent/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -297,6 +306,21 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "backtrace" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" +dependencies = [ + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.13.0" @@ -862,6 +886,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" + [[package]] name = "gloo-timers" version = "0.2.1" @@ -1474,6 +1504,15 @@ name = "nvpair-sys" version = "0.4.0" source = "git+https://github.com/ahrens/rust-libzfs?branch=work#9f6ff365ca4812440f414eb534279c9c1566c0ae" +[[package]] +name = "object" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39f37e50073ccad23b6d09bcb5b263f4e76d3bb6038e4a3c08e52162ffa8abc2" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.8.0" @@ -1849,6 +1888,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + [[package]] name = "rustc_version" version = "0.4.0" @@ -2534,6 +2579,7 @@ dependencies = [ "anyhow", "async-stream", "async-trait", + "backtrace", "bincode", "chrono", "config", diff --git a/cmd/zfs_object_agent/zettacache/Cargo.toml b/cmd/zfs_object_agent/zettacache/Cargo.toml index 9347bb447376..4d9edebbb8d4 100644 --- a/cmd/zfs_object_agent/zettacache/Cargo.toml +++ b/cmd/zfs_object_agent/zettacache/Cargo.toml @@ -10,6 +10,7 @@ edition = "2018" anyhow = "1.0" async-stream = "0.3.0" async-trait = "0.1.51" +backtrace = "0.3" bincode = "1.3.2" chrono = "0.4" config = "0.11" diff --git a/cmd/zfs_object_agent/zettacache/src/die.rs b/cmd/zfs_object_agent/zettacache/src/die.rs index e88501ae56ee..c0f65caf2fc8 100644 --- a/cmd/zfs_object_agent/zettacache/src/die.rs +++ b/cmd/zfs_object_agent/zettacache/src/die.rs @@ -13,6 +13,7 @@ //! caller and having it "always" die on that caller. use crate::get_tunable; +use backtrace::Backtrace; use lazy_static::lazy_static; use log::*; use std::{ @@ -69,8 +70,10 @@ where } if location == *DIE_LOCATION { let msg = f(); - warn!("exiting to test failure handling: {}", msg); - panic!("exiting to test failure handling: {}", msg); + let backtrace = Backtrace::new(); + warn!("exiting to test failure handling: {} {:?}", msg, backtrace); + println!("exiting to test failure handling: {} {:?}", msg, backtrace); + std::process::exit(0); } } }