Skip to content

fix(plugins): blocking std::fs calls in async update_one_plugin #4560

@bug-ops

Description

@bug-ops

Description

PluginManager::update_one_plugin (an async fn) contains two blocking std::fs calls that execute directly on the async executor thread after the main spawn_blocking block completes:

  • Line 830: std::fs::write(&source_dest, toml_str) — writes source metadata
  • Line 834: std::fs::read_to_string(plugin.path.join(".plugin.toml")) — reads the updated manifest to detect the new version

These calls block the Tokio thread pool for the duration of the I/O. Under concurrent auto-update checks (check_auto_updates spawns N tasks via join_all) this can saturate the executor.

Reproduction Steps

  1. Configure multiple remote plugins in ~/.local/share/zeph/plugins/
  2. Enable auto_update = true in config
  3. Observe: agent operations may stall during concurrent auto-update tasks

Expected Behavior

All blocking filesystem operations inside async functions must be wrapped in tokio::task::spawn_blocking or replaced with tokio::fs equivalents.

Actual Behavior

std::fs::write and std::fs::read_to_string called directly on the async executor after the spawn_blocking block, at crates/zeph-plugins/src/manager.rs lines ~830–834.

Fix

Move both calls into the existing apply_staged_update spawn_blocking closure, or wrap in a separate tokio::task::spawn_blocking.

Metadata

Metadata

Assignees

Labels

P3Research — medium-high complexitybugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions