From 93c87607883b60e7892c9a925b5ff716b051122c Mon Sep 17 00:00:00 2001 From: Accusys Date: Fri, 18 Sep 2026 05:38:40 +0800 Subject: [PATCH] fix: prevent VLM panic by using try_read instead of blocking_read ** Problem: - get_face_filter_defaults() used blocking_read() in sync context - Caused panic: 'Cannot block the current thread from within a runtime' - VLM generation repeatedly failed with panic ** Root Cause: - admin_config.rs:473: ADMIN_CONFIG.config.blocking_read() - Called from FileProfile::defaults() which runs in async context - Tokio runtime doesn't allow blocking operations ** Fix: - Replace blocking_read() with try_read() - Fall back to hardcoded defaults if config is locked - Non-blocking, safe for async context ** Impact: - VLM summaries now generate successfully - No more panics in VLM processing - Job 779 VLM generation now working --- src/core/admin_config.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/core/admin_config.rs b/src/core/admin_config.rs index 1cc75cb4..964ec289 100644 --- a/src/core/admin_config.rs +++ b/src/core/admin_config.rs @@ -468,15 +468,25 @@ pub async fn get_filter_config(key: &str) -> Option { /// Synchronous version for getting face filter defaults /// Used in synchronous contexts like FileProfile::defaults() pub fn get_face_filter_defaults() -> (f64, i32, f64) { - // Use blocking_read for sync context - // Returns (min_confidence, min_size, min_capture_quality) - let config = ADMIN_CONFIG.config.blocking_read(); + // Try to read without blocking - use try_read for non-blocking access + // If config is locked, fall back to hardcoded defaults + let config = ADMIN_CONFIG.config.try_read(); - ( - config.face_filter_defaults.min_confidence, - config.face_filter_defaults.min_size, - config.face_filter_defaults.min_capture_quality, - ) + match config { + Ok(cfg) => ( + cfg.face_filter_defaults.min_confidence, + cfg.face_filter_defaults.min_size, + cfg.face_filter_defaults.min_capture_quality, + ), + Err(_) => { + // Config locked, use hardcoded defaults + ( + crate::core::config::FACE_MIN_CONFIDENCE_DEFAULT, + crate::core::config::FACE_MIN_SIZE_DEFAULT, + 0.25, // min_capture_quality default + ) + } + } } pub async fn get_paths() -> PathsConfig {