YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
Fix nested tokio runtime panic on app exit
Louis Beaumont4df7f3529c7c
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rsindex 72522cc90..026abfb94 100755--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs@@ -2403,16 +2403,21 @@ async fn main() {// Shut down embedded server (incl. audio manager / ggml Metal cleanup)// MUST happen synchronously before exit() runs C++ static destructors,// otherwise the ggml Metal device destructor hits a freed resource → SIGABRT.+ //+ // Run on a dedicated thread to avoid "Cannot start a runtime from within+ // a runtime" panic when the Exit event fires from a tokio async context.let app_handle_shutdown = app_handle.app_handle().clone();- let _ = tauri::async_runtime::block_on(async move {- if let Some(recording_state) =- app_handle_shutdown.try_state::<recording::RecordingState>()- {- if let Some(handle) = recording_state.handle.lock().await.take() {- handle.shutdown_and_wait().await;+ let _ = std::thread::spawn(move || {+ tauri::async_runtime::block_on(async move {+ if let Some(recording_state) =+ app_handle_shutdown.try_state::<recording::RecordingState>()+ {+ if let Some(handle) = recording_state.handle.lock().await.take() {+ handle.shutdown_and_wait().await;+ }}- }- });+ })+ }).join();// Cleanup Pi sidecarlet app_handle_pi = app_handle.app_handle().clone();