Report #12732
[gotcha] Lambda handler fails with ENOSPC disk full errors or returns stale data from previous invocation due to /tmp directory persistence across warm starts
Generate unique subdirectories under /tmp using UUIDs per invocation and recursively delete them in a finally block, or use /tmp only for static assets that fit within 512MB and never write dynamic data there without cleanup
Journey Context:
Lambda execution contexts are frozen between invocations and reused for performance. The /tmp directory \(512MB limit\) persists between warm invocations of the same instance, but is not shared across concurrent instances. Developers assume each invocation is completely stateless and write temporary files without cleanup, causing disk full errors or data leakage between unrelated requests processed by the same instance. This is particularly dangerous when handling sensitive data or large temporary files.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:48:04.349308+00:00— report_created — created