SafeDisk AI

Audio Temp Files Fill /tmp After Upload

Podcast, video, and media-generation workers often write composed output to a temp file, upload it, then forget to remove the temp file. The safe fix is not a broad rm -rf /tmp; first prove which generated files are stale, then delete only temp outputs whose upload already succeeded.

Cleanup request

Get the exact cleanup step.

Leave your email now. The scan summary can follow after the first reply; we send the $29 Deep Cleanup step only if review-first storage remains.

No payment on this step. We reply first; the $29 Deep Cleanup is only for review-first cases.

See sample result

Measure The Temp File Backlog

Start with read-only checks. They list temp-dir capacity and the largest composed audio files without opening file contents.

Read-only check

Find generated audio files that are filling temp storage.

Use this before deleting anything. It works on Linux/macOS workers and stays scoped to likely composed audio outputs.

tmp="${TMPDIR:-/tmp}"
echo "tmp=$tmp"
df -h "$tmp" 2>/dev/null || true
df -i "$tmp" 2>/dev/null || true

find "$tmp" -maxdepth 1 -type f \( -name 'composed_*.mp3' -o -name 'composed_*.wav' -o -name 'composed_*.m4a' \) -print0 2>/dev/null \
  | xargs -0 du -h 2>/dev/null \
  | sort -hr \
  | head -40

Safe Cleanup Boundary

  1. Keep failed-upload temp files so retries still have source bytes.
  2. Delete only after the upload returns success and the object key is recorded.
  3. Restrict cleanup to the system temp directory after resolving the real path.
  4. Require regular files with expected generated names such as composed_*.mp3.
  5. Never delete user uploads, project assets, data/, or working directories from this cleanup path.
  6. Log path, byte size, episode ID, and cleanup result, but not audio contents.
Emergency reclaim

Move only old generated temp files to a quarantine folder.

Use this only after confirming these files are stale or already uploaded. It moves files instead of permanently deleting them.

tmp="${TMPDIR:-/tmp}"
quarantine="$tmp/safedisk-audio-temp-quarantine-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$quarantine"

find "$tmp" -maxdepth 1 -type f \( -name 'composed_*.mp3' -o -name 'composed_*.wav' -o -name 'composed_*.m4a' \) -mmin +120 -print0 2>/dev/null \
  | while IFS= read -r -d '' file; do
      mv "$file" "$quarantine/"
    done

du -sh "$quarantine" 2>/dev/null || true

Implementation Guardrails

Need a cleanup order for a live worker?

Copy the read-only check first. Request the $29 Deep Cleanup only if the output, app state, or cleanup boundary is still not obvious.

Deep Cleanup

Need a safe cleanup order?

Send the issue link, log excerpt, or storage summary first. We reply with the next safe move and offer the $29 Deep Cleanup only if the incident still needs review.