Engineering Analysis · Global
Set a cleanup window for unfinished S3 uploads
Unfinished multipart uploads are a different cleanup problem from old objects. Give resumable uploads time, then measure and remove abandoned parts.
By Launchr Space ·
A video uploader can look healthy while unfinished jobs accumulate behind it. A user closes a tab, a retry never resumes, or a device changes networks just before the final request. Multipart parts can remain without a completed object appearing in the product. A cleanup policy for completed objects does not solve this particular problem. Amazon S3 supports a lifecycle action specifically for multipart uploads left unfinished for a configured number of days after initiation.
Start with the intended resume window
Ask how long someone can reasonably return and resume an upload. A short-lived browser preview and a long ingest pipeline should not automatically share a deadline. Measure how long successful uploads actually take and identify old unfinished sessions before choosing the threshold. Scope an initial rule to a suitable prefix or a controlled test bucket and record why that boundary exists. The lifecycle action can apply to existing as well as future unfinished uploads.
Test both sides of the boundary
In a staging bucket, leave one multipart upload intentionally incomplete and complete another with the same prefix. Also test a resumed upload near the application’s own advertised deadline. Verify that the completed object stays readable and that the product can start a new upload if an old upload ID no longer works. Treat the S3 threshold as eligibility for cleanup, not a promise that removal happens at an exact minute.
Give cancellation its own path
When a user explicitly cancels, the application should close its job state and attempt to abort the matching upload through the normal authorized backend path. Keep the lifecycle policy as a backstop for outages and tabs that disappear without cancellation. Track completion and abandon rates as well as storage trends. If completion drops after a rollout, check whether the cleanup window conflicts with a legitimate resume pattern before extending it for every upload. Record who owns the rule and set a follow-up date for the first review.