You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Markdown import reads every file with blocking std::fs::read_to_string inside async daemon tasks #2961
Running a large/slow markdown import — including the documented nodespace import dir ../nodespace-docs --auto-collection-routing workflow — can degrade concurrent daemon responsiveness (ai-chat streaming, WatchNodes delivery, other RPCs) for the duration of the import, because a blocking syscall run directly on a shared tokio worker thread prevents that worker from polling any other task until the read completes.
Root cause
import_single_file() (packages/daemon/src/services/import_service.rs:172) and the batch-import phase-1 loop in run_batch_import() (line 344) both call std::fs::read_to_string(path) directly inside async fns that run on the daemon's shared multi-threaded tokio runtime, with no spawn_blocking wrapper. Every other file-I/O call site in this crate (database_manager.rs, settings_service.rs) consistently uses tokio::fs, and this codebase has an established, explicitly-documented convention (assembly.rs, local_agent_service.rs) of wrapping slow synchronous work in spawn_blocking specifically to avoid parking a tokio worker thread — this file is the one outlier. run_batch_import's read loop is sequential, so the blocking reads happen one after another inside a single spawned task.
Suggested fix
Replace std::fs::read_to_string with tokio::fs::read_to_string (or wrap in spawn_blocking) in both import_single_file and run_batch_import's read loop, matching the crate's own established convention elsewhere.
Found via the 2026-09-25 full-repo code sweep (finding #11 of 84 in CODE_SWEEP_FINDINGS_2026-09-25.md). Severity: medium. Category: risky.
Activity
Keep markdown import off async workers and cap batch size