Skip to content

Terminal jobs are retained indefinitely because sweep_terminals is never called in runtime code #72

@nficano

Description

@nficano

Category: bug Severity: major
Location: crates/arcp-runtime/src/runtime/job.rs:135-139

What

The registry has a terminal-job sweep helper, but production runtime code never calls it. Completed, failed, and cancelled jobs remain in the shared DashMap indefinitely, causing unbounded memory growth on long-running runtimes.

Evidence

/// Drop terminal jobs from the registry. Should be called periodically
/// (Phase 5+) to cap memory.
pub fn sweep_terminals(&self) {
    self.inner.retain(|_, r| !r.entry.state.is_terminal());
}

Proposed fix

Call terminal sweeping from a bounded retention policy, background maintenance task, or registry insertion/transition path, preserving recent list-jobs visibility without unbounded retention.

Acceptance criteria

  • After the configured terminal retention window, completed jobs are removed from JobRegistry and JobRegistry::len() does not grow with historical terminal jobs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions