Skip to content

Temp WAV files in /dev/shm not cleaned up on error → shm fills → sox RIFF header failures #1076

@meckmyday-source

Description

@meckmyday-source

Summary

Temp WAV files in /dev/shm are not cleaned up on certain error paths, leading to shm filling completely. Once shm is full, sox writes 0-byte WAVs and subsequent combines fail with RIFF header errors, and TrunkRecorder stops producing call files until restarted.

Environment

  • Docker image: robotastic/trunk-recorder:latest (Created: 2025-12-11)
  • Host: Raspberry Pi
  • /dev/shm size: 512M
  • Issue observed intermittently before and after 2025-12-11 (container rebuild was an attempted mitigation)

Behavior

  • Normal: /dev/shm holds ~20–30 min of temp WAVs and old ones get deleted.
  • Failure: temp WAVs stop being deleted, shm fills to 100%.
  • After fill: new WAVs are 0 bytes → sox RIFF errors → no output to /data.
  • Restart container restores normal behavior.
  • This does not happen continuously; it appears after certain error conditions and then never self-recovers.

Logs/snippet

(Include short snippet)
sox FAIL formats: can't open input file `/dev/shm/...wav': WAVE: RIFF header not found
Failed to combine recordings

Evidence

I added a watchdog that monitors /dev/shm usage; restarting the container immediately restores normal cleanup behavior.

Suggested area

Likely a cleanup code path not being hit after combine/convert errors. This is reproducible over time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions