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: resolve runtime nesting panic on Linux (#2176)
Chris8538fd853e22
diff --git a/crates/screenpipe-server/src/bin/screenpipe-server.rs b/crates/screenpipe-server/src/bin/screenpipe-server.rsindex d5bf59137..cfe857a82 100644--- a/crates/screenpipe-server/src/bin/screenpipe-server.rs+++ b/crates/screenpipe-server/src/bin/screenpipe-server.rs@@ -49,7 +49,7 @@ use std::{sync::Arc,time::Duration,};-use tokio::{runtime::Runtime, signal, sync::broadcast};+use tokio::{runtime::Handle, signal, sync::broadcast};use tracing::{debug, error, info, warn};use tracing_appender::non_blocking::WorkerGuard;use tracing_appender::rolling::{RollingFileAppender, Rotation};@@ -826,11 +826,8 @@ async fn main() -> anyhow::Result<()> {let vad_sensitivity_clone = cli.vad_sensitivity.clone();let (shutdown_tx, _) = broadcast::channel::<()>(1);- let vision_runtime = Runtime::new().unwrap();- let pipes_runtime = Runtime::new().unwrap();-- let vision_handle = vision_runtime.handle().clone();- let pipes_handle = pipes_runtime.handle().clone();+ let vision_handle = Handle::current();+ let pipes_handle = Handle::current();let db_clone = Arc::clone(&db);let output_path_clone = Arc::new(local_data_dir.join("data").to_string_lossy().into_owned());@@ -1470,8 +1467,6 @@ async fn main() -> anyhow::Result<()> {}tokio::task::block_in_place(|| {- drop(pipes_runtime);- drop(vision_runtime);drop(audio_manager);});diff --git a/crates/screenpipe-vision/src/browser_utils/linux.rs b/crates/screenpipe-vision/src/browser_utils/linux.rsindex 9dcab41e4..a47c07d8f 100644--- a/crates/screenpipe-vision/src/browser_utils/linux.rs+++ b/crates/screenpipe-vision/src/browser_utils/linux.rs@@ -9,6 +9,7 @@ use atspi_common::State;use atspi_proxies::document::DocumentProxy;use std::future::Future;use std::pin::Pin;+use tokio::runtime::Handle;use tracing::{debug, error};use zbus::fdo::DBusProxy;@@ -289,12 +290,14 @@ impl BrowserUrlDetector for LinuxUrlDetector {process_id: i32,window_title: &str,) -> Result<Option<String>> {- tokio::runtime::Runtime::new()- .unwrap()- .block_on(Self::get_active_url_from_window(+ // Use block_in_place to avoid blocking the runtime worker thread+ // Then use Handle::current().block_on to run the async code+ tokio::task::block_in_place(|| {+ Handle::current().block_on(Self::get_active_url_from_window(process_id,window_title,app_name,))+ })}}