BUG: Multipart upload failure leaves dangling S3 parts and 'ingesting' asset row — no cleanup on error #85
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
When a multipart upload fails mid-way (e.g., network disconnection during part upload), neither the frontend (
screens-ingest.jsx) nor the server cleans up the dangling resources:status = 'ingesting'— a zombie assetFrontend (
services/web-ui/public/screens-ingest.jsx):The
_uploadFilefunction's multipart branch creates the asset row and S3 multipart upload in thePOST /upload/initstep, then uploads parts in a loop. If the loop throws (e.g., part upload fails), control falls to the caller'scatchhandler instartUpload:The
catchonly updates the UI row — it never callsPOST /upload/abortto clean up the dangling S3 parts or delete the asset row.Backend (
services/mam-api/src/routes/upload.js):The
POST /abortroute exists and correctly aborts the S3 multipart upload and deletes the asset row. It's just never called on failure.Suggested fix: In the
_uploadFilefunction's multipart branch, wrap the part upload loop and complete call in a try/catch that callsPOST /upload/abortbefore re-throwing the error. Something like:(This is already partially tracked by existing issue #73 which covers BullMQ orphan jobs, but this is a different concern — S3 + DB cleanup vs. queue cleanup.)