diff --git a/Cargo.lock b/Cargo.lock index bafb81479..3f0c76e7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,12 +99,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "aligned-vec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" - [[package]] name = "alloc-no-stdlib" version = "2.0.4" @@ -202,23 +196,6 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" -[[package]] -name = "arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" - -[[package]] -name = "arg_enum_proc_macro" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "arrayref" version = "0.3.7" @@ -526,29 +503,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" -[[package]] -name = "av1-grain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" -dependencies = [ - "anyhow", - "arrayvec", - "log", - "nom", - "num-rational", - "v_frame", -] - -[[package]] -name = "avif-serialize" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876c75a42f6364451a033496a14c44bffe41f5f4a8236f697391f11024e596d2" -dependencies = [ - "arrayvec", -] - [[package]] name = "aws-config" version = "1.5.1" @@ -1163,12 +1117,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bitstream-io" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c12d1856e42f0d817a835fe55853957c85c8c8a470114029143d3f12671446e" - [[package]] name = "bitvec" version = "1.0.1" @@ -1317,12 +1265,6 @@ dependencies = [ "serde", ] -[[package]] -name = "built" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a6c0b39c38fd754ac338b00a88066436389c0f029da5d37d1e01091d9b7c17" - [[package]] name = "builtin-psl-connectors" version = "0.1.0" @@ -1362,12 +1304,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "byteorder-lite" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" - [[package]] name = "bytes" version = "1.6.0" @@ -4437,35 +4373,20 @@ dependencies = [ [[package]] name = "image" -version = "0.25.1" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd54d660e773627692c524beaad361aca785a4f9f5730ce91f42aabe5bce3d11" +checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" dependencies = [ "bytemuck", "byteorder", "color_quant", "exr", "gif", - "image-webp", + "jpeg-decoder", "num-traits", "png", "qoi", - "ravif", - "rayon", - "rgb", "tiff", - "zune-core", - "zune-jpeg", -] - -[[package]] -name = "image-webp" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d730b085583c4d789dfd07fdcf185be59501666a90c97c40162b37e4fdad272d" -dependencies = [ - "byteorder-lite", - "thiserror", ] [[package]] @@ -4474,12 +4395,6 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" -[[package]] -name = "imgref" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126" - [[package]] name = "include_dir" version = "0.7.3" @@ -4595,17 +4510,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "interpolate_name" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "ipconfig" version = "0.3.2" @@ -4649,15 +4553,6 @@ version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" -[[package]] -name = "iter_tools" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f85582248e8796b1d7146eabe9f70c5b9de4db16bf934ca893581d33c66403b6" -dependencies = [ - "itertools 0.11.0", -] - [[package]] name = "itertools" version = "0.10.5" @@ -4667,15 +4562,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -4765,6 +4651,9 @@ name = "jpeg-decoder" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" +dependencies = [ + "rayon", +] [[package]] name = "js-sys" @@ -4968,17 +4857,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "libfuzzer-sys" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" -dependencies = [ - "arbitrary", - "cc", - "once_cell", -] - [[package]] name = "libheif-rs" version = "1.0.2" @@ -5599,15 +5477,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "loop9" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" -dependencies = [ - "imgref", -] - [[package]] name = "lru" version = "0.7.8" @@ -5745,16 +5614,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" -[[package]] -name = "maybe-rayon" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" -dependencies = [ - "cfg-if", - "rayon", -] - [[package]] name = "md-5" version = "0.10.6" @@ -6315,12 +6174,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "noop_proc_macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" - [[package]] name = "normpath" version = "1.2.0" @@ -6426,17 +6279,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "num-integer" version = "0.1.46" @@ -7008,8 +6850,9 @@ dependencies = [ [[package]] name = "pdfium-render" -version = "0.8.21" -source = "git+https://github.com/fogodev/pdfium-render.git?rev=e7aa1111f441c49e857cebda15b4e51b24356aaa#e7aa1111f441c49e857cebda15b4e51b24356aaa" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d2f2669618a1ae68a86fe975fdda1c6a0b6dc9d5358ea8d2cdcd8da3307e5a" dependencies = [ "bindgen", "bitflags 2.5.0", @@ -7019,7 +6862,7 @@ dependencies = [ "console_error_panic_hook", "console_log", "image", - "iter_tools", + "itertools 0.13.0", "js-sys", "libloading 0.8.3", "log", @@ -7683,19 +7526,6 @@ name = "profiling" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" -dependencies = [ - "profiling-procmacros", -] - -[[package]] -name = "profiling-procmacros" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" -dependencies = [ - "quote", - "syn 2.0.66", -] [[package]] name = "prometheus-client" @@ -7893,12 +7723,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quick-protobuf" version = "0.8.1" @@ -8083,56 +7907,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rav1e" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9" -dependencies = [ - "arbitrary", - "arg_enum_proc_macro", - "arrayvec", - "av1-grain", - "bitstream-io", - "built", - "cfg-if", - "interpolate_name", - "itertools 0.12.1", - "libc", - "libfuzzer-sys", - "log", - "maybe-rayon", - "new_debug_unreachable", - "noop_proc_macro", - "num-derive", - "num-traits", - "once_cell", - "paste", - "profiling", - "rand 0.8.5", - "rand_chacha 0.3.1", - "simd_helpers", - "system-deps", - "thiserror", - "v_frame", - "wasm-bindgen", -] - -[[package]] -name = "ravif" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc13288f5ab39e6d7c9d501759712e6969fcc9734220846fc9ed26cae2cc4234" -dependencies = [ - "avif-serialize", - "imgref", - "loop9", - "quick-error 2.0.1", - "rav1e", - "rayon", - "rgb", -] - [[package]] name = "raw-cpuid" version = "10.7.0" @@ -8403,7 +8177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ "hostname 0.3.1", - "quick-error 1.2.3", + "quick-error", ] [[package]] @@ -9862,15 +9636,6 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" -[[package]] -name = "simd_helpers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" -dependencies = [ - "quote", -] - [[package]] name = "simplecss" version = "0.2.1" @@ -11823,17 +11588,6 @@ dependencies = [ "serde", ] -[[package]] -name = "v_frame" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b" -dependencies = [ - "aligned-vec", - "num-traits", - "wasm-bindgen", -] - [[package]] name = "valuable" version = "0.1.0" @@ -12104,9 +11858,9 @@ dependencies = [ [[package]] name = "webp" -version = "0.3.0" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f53152f51fb5af0c08484c33d16cca96175881d1f3dec068c23b31a158c2d99" +checksum = "4bb5d8e7814e92297b0e1c773ce43d290bef6c17452dafd9fc49e5edb5beba71" dependencies = [ "image", "libwebp-sys", @@ -13132,12 +12886,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "zune-core" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" - [[package]] name = "zune-inflate" version = "0.2.54" @@ -13147,15 +12895,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "zune-jpeg" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec866b44a2a1fd6133d363f073ca1b179f438f99e7e5bfb1e33f7181facfe448" -dependencies = [ - "zune-core", -] - [[package]] name = "zvariant" version = "4.0.0" diff --git a/Cargo.toml b/Cargo.toml index 349d571ad..1cc1388c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ gix-ignore = "0.11.2" globset = "0.4.14" http = "0.2" # Update blocked by axum hyper = "0.14" # Update blocked due to API breaking changes -image = "0.25.1" +image = "0.24.9" # Update blocked due to https://github.com/image-rs/image/issues/2230 itertools = "0.13.0" lending-stream = "1.0" libc = "0.2" @@ -66,7 +66,7 @@ tracing-subscriber = "0.3.18" tracing-test = "0.2.5" uhlc = "0.6.0" # Must follow version used by specta uuid = "1.8" -webp = "0.3.0" +webp = "0.2.6" # Update blocked by image [workspace.dependencies.prisma-client-rust] git = "https://github.com/brendonovich/prisma-client-rust" @@ -101,8 +101,6 @@ libp2p-stream = { git = "https://github.com/spacedriveapp/rust-libp2p.git", rev blake3 = { git = "https://github.com/spacedriveapp/blake3.git", rev = "d3aab416c12a75c2bfabce33bcd594e428a79069" } -# Due to image crate version bump -pdfium-render = { git = "https://github.com/fogodev/pdfium-render.git", rev = "e7aa1111f441c49e857cebda15b4e51b24356aaa" } [profile.dev] # Make compilation faster on macOS @@ -143,7 +141,7 @@ incremental = false # Optimize release builds [profile.release] -panic = "abort" # Strip expensive panic clean-up logic +panic = "unwind" # Sadly we need unwind to avoid unexpected crashes on third party crates codegen-units = 1 # Compile crates one after another so the compiler can optimize better lto = true # Enables link to optimizations opt-level = "s" # Optimize for binary size diff --git a/core/crates/heavy-lifting/src/job_system/error.rs b/core/crates/heavy-lifting/src/job_system/error.rs index 98c5b8f8e..4ae944b2e 100644 --- a/core/crates/heavy-lifting/src/job_system/error.rs +++ b/core/crates/heavy-lifting/src/job_system/error.rs @@ -30,6 +30,9 @@ pub enum JobSystemError { #[error(transparent)] Report(#[from] ReportError), + + #[error("internal job panic! ")] + Panic(JobId), } impl From for rspc::Error { diff --git a/core/crates/heavy-lifting/src/job_system/job.rs b/core/crates/heavy-lifting/src/job_system/job.rs index 91b3173b1..0a3642797 100644 --- a/core/crates/heavy-lifting/src/job_system/job.rs +++ b/core/crates/heavy-lifting/src/job_system/job.rs @@ -13,6 +13,7 @@ use std::{ hash::{Hash, Hasher}, marker::PhantomData, ops::{Deref, DerefMut}, + panic::AssertUnwindSafe, path::Path, pin::pin, sync::Arc, @@ -21,7 +22,7 @@ use std::{ use async_channel as chan; use chrono::{DateTime, Utc}; -use futures::{stream, Future, StreamExt}; +use futures::{stream, Future, FutureExt, StreamExt}; use futures_concurrency::{ future::{Join, TryJoin}, stream::Merge, @@ -750,15 +751,29 @@ where trace!("Dispatching job"); - spawn(to_spawn_job::( - self.id, - self.job, - ctx.clone(), - None, - base_dispatcher, - commands_rx, - done_tx, - )); + spawn({ + let id = self.id; + let job = self.job; + let ctx = ctx.clone(); + + async move { + if AssertUnwindSafe(to_spawn_job::( + id, + job, + ctx, + None, + base_dispatcher, + commands_rx, + done_tx, + )) + .catch_unwind() + .await + .is_err() + { + error!("job panicked"); + } + } + }); JobHandle { id: self.id, @@ -791,15 +806,29 @@ where trace!("Resuming job"); - spawn(to_spawn_job::( - self.id, - self.job, - ctx.clone(), - serialized_tasks, - base_dispatcher, - commands_rx, - done_tx, - )); + spawn({ + let id = self.id; + let job = self.job; + let ctx = ctx.clone(); + + async move { + if AssertUnwindSafe(to_spawn_job::( + id, + job, + ctx, + serialized_tasks, + base_dispatcher, + commands_rx, + done_tx, + )) + .catch_unwind() + .await + .is_err() + { + error!("job panicked"); + } + } + }); JobHandle { id: self.id, @@ -855,9 +884,14 @@ async fn to_spawn_job( spawn( async move { - tx.send(job.run::(dispatcher, ctx).await) - .await - .expect("job run channel closed"); + tx.send( + AssertUnwindSafe(job.run::(dispatcher, ctx)) + .catch_unwind() + .await + .unwrap_or(Err(Error::JobSystem(JobSystemError::Panic(job_id)))), + ) + .await + .expect("job run channel closed"); } .in_current_span(), ); diff --git a/core/crates/heavy-lifting/src/media_processor/helpers/thumbnailer.rs b/core/crates/heavy-lifting/src/media_processor/helpers/thumbnailer.rs index 5f636f606..caa06a3fe 100644 --- a/core/crates/heavy-lifting/src/media_processor/helpers/thumbnailer.rs +++ b/core/crates/heavy-lifting/src/media_processor/helpers/thumbnailer.rs @@ -14,6 +14,7 @@ use sd_file_ext::extensions::{VideoExtension, ALL_VIDEO_EXTENSIONS}; use std::{ ops::Deref, + panic, path::{Path, PathBuf}, str::FromStr, time::Duration, @@ -313,9 +314,9 @@ pub async fn generate_thumbnail( } fn inner_generate_image_thumbnail( - file_path: PathBuf, + file_path: &PathBuf, ) -> Result, thumbnailer::NonCriticalThumbnailerError> { - let mut img = format_image(&file_path).map_err(|e| { + let mut img = format_image(file_path).map_err(|e| { thumbnailer::NonCriticalThumbnailerError::FormatImage(file_path.clone(), e.to_string()) })?; @@ -336,7 +337,7 @@ fn inner_generate_image_thumbnail( // this corrects the rotation/flip of the image based on the *available* exif data // not all images have exif data, so we don't error. we also don't rotate HEIF as that's against the spec - if let Some(orientation) = Orientation::from_path(&file_path) { + if let Some(orientation) = Orientation::from_path(file_path) { if ConvertibleExtension::try_from(file_path.as_ref()) .expect("we already checked if the image was convertible") .should_rotate() @@ -347,7 +348,10 @@ fn inner_generate_image_thumbnail( // Create the WebP encoder for the above image let encoder = Encoder::from_image(&img).map_err(|reason| { - thumbnailer::NonCriticalThumbnailerError::WebPEncoding(file_path, reason.to_string()) + thumbnailer::NonCriticalThumbnailerError::WebPEncoding( + file_path.clone(), + reason.to_string(), + ) })?; // Type `WebPMemory` is !Send, which makes the `Future` in this function `!Send`, @@ -378,7 +382,19 @@ async fn generate_image_thumbnail( move || { // Handling error on receiver side - let _ = tx.send(inner_generate_image_thumbnail(file_path)); + + let _ = tx.send( + panic::catch_unwind(|| inner_generate_image_thumbnail(&file_path)).unwrap_or_else( + move |_| { + Err( + thumbnailer::NonCriticalThumbnailerError::PanicWhileGeneratingThumbnail( + file_path, + "Internal panic on third party crate".to_string(), + ), + ) + }, + ), + ); } }); diff --git a/crates/task-system/src/system.rs b/crates/task-system/src/system.rs index 904b0a5eb..f64887bc3 100644 --- a/crates/task-system/src/system.rs +++ b/crates/task-system/src/system.rs @@ -44,7 +44,7 @@ impl System { let workers_count = usize::max( std::thread::available_parallelism().map_or_else( |e| { - error!("Failed to get available parallelism in the job system: {e:#?}"); + error!(?e, "Failed to get available parallelism in the job system"); 1 }, NonZeroUsize::get, diff --git a/crates/task-system/src/worker/runner.rs b/crates/task-system/src/worker/runner.rs index d99981558..e9ab8da9e 100644 --- a/crates/task-system/src/worker/runner.rs +++ b/crates/task-system/src/worker/runner.rs @@ -1,6 +1,8 @@ use std::{ + any::Any, collections::{HashMap, VecDeque}, future::pending, + panic::AssertUnwindSafe, pin::pin, sync::{ atomic::{AtomicBool, Ordering}, @@ -53,7 +55,7 @@ struct AbortAndSuspendSignalers { struct RunningTask { id: TaskId, kind: PendingTaskKind, - handle: JoinHandle<()>, + handle: JoinHandle>>, } enum WaitingSuspendedTask { @@ -150,7 +152,7 @@ impl Runner { &mut self, task_id: TaskId, task_work_state: TaskWorkState, - ) -> JoinHandle<()> { + ) -> JoinHandle>> { let (abort_tx, abort_rx) = oneshot::channel(); let (suspend_tx, suspend_rx) = oneshot::channel(); @@ -163,13 +165,16 @@ impl Runner { ); let handle = spawn( - run_single_task( - task_work_state, - self.task_output_tx.clone(), - suspend_rx, - abort_rx, + AssertUnwindSafe( + run_single_task( + task_work_state, + self.task_output_tx.clone(), + suspend_rx, + abort_rx, + ) + .in_current_span(), ) - .in_current_span(), + .catch_unwind(), ); trace!("Task runner spawned"); @@ -624,8 +629,14 @@ impl Runner { } } - if let Err(e) = handle.await { - error!(%task_id, ?e, "Task failed to join"); + match handle.await { + Ok(Ok(())) => { /* Everything is Awesome! */ } + Ok(Err(_)) => { + error!(%task_id, "Task panicked"); + } + Err(e) => { + error!(%task_id, ?e, "Task failed to join"); + } } stolen_task_tx.close(); @@ -806,8 +817,14 @@ impl Runner { assert_eq!(*finished_task_id, old_task_id, "Task output id mismatch"); // Sanity check - if let Err(e) = handle.await { - error!(?e, "Task failed to join"); + match handle.await { + Ok(Ok(())) => { /* Everything is Awesome! */ } + Ok(Err(_)) => { + error!("Task panicked"); + } + Err(e) => { + error!(?e, "Task failed to join"); + } } if let Some((next_task_kind, task_work_state)) = self.get_next_task() { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 744175d52..c6e4d7d50 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.78" +channel = "1.79"