Menu

#8 Stale task directories never cleaned up

closed
nobody
None
2026-04-23
2026-03-24
Anonymous
No

Originally created by: kumaakh
Originally owned by: joiskash

Problem

Long-running tasks create directories at ~/.fleet-tasks/<taskId>/ containing output logs, activity markers, and PID files. These directories are never cleaned up after the task completes. Over time they accumulate and consume disk space on cloud VMs.

Expected behavior

  • Task directories should be cleaned up after successful task completion (or after a configurable retention period)
  • Failed task directories should be retained for debugging (with an expiry, e.g., 7 days)
  • A manual cleanup command would also be useful: fleet task cleanup --older-than 7d

Priority: LOW

Disk space issue on long-lived VMs. Not urgent but will become a problem over months of use.

Source

Code review Round 3, new finding.

Related

Tickets: #169
Tickets: #71

Discussion

  • Anonymous

    Anonymous - 2026-03-24
     
  • Anonymous

    Anonymous - 2026-04-23

    Originally posted by: kumaakh

    Fixed in main: PR [#175] (fix: send_files collision detection + stale task cleanup) introduced src/services/task-cleanup.ts which implements automatic cleanup of ~/.fleet-tasks/<taskId>/ directories. Completed tasks are retained for 1 hour (configurable via FLEET_TASK_RETENTION_HOURS_SUCCESS), failed tasks for 7 days (configurable via FLEET_TASK_RETENTION_HOURS). Live PID detection prevents deletion of running tasks. scheduleTaskCleanup() is called on task completion/failure, and cleanupStaleTasks() runs on startup.

     

    Related

    Tickets: #175

  • Anonymous

    Anonymous - 2026-04-23

    Ticket changed by: kumaakh

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB