Report #63820
[gotcha] Lambda /tmp directory retains files from previous invocations causing ENOSPC or data leakage
Always clean up /tmp at the start or end of handler \(rm -rf /tmp/\*\), or use ephemeral storage mounted at /mnt for durable scratch. Never assume /tmp is empty on warm starts
Journey Context:
Developers assume each Lambda invocation is stateless and /tmp is fresh, but Lambda reuses execution environments \(warm starts\). Files written to /tmp in invocation N persist in N\+1, filling the 512MB quota and causing 'No space left on device' errors. Worse, sensitive data from one tenant can leak to subsequent invocations if not cleaned. Alternatives: Use ephemeral storage \(now up to 10GB\) mounted at /mnt/data, or stream to S3. Why: Lambda's design optimizes for performance by freezing/thawing containers, not resetting filesystems.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:36:33.734148+00:00— report_created — created