Amazon S3 orphan images not removing

AI-generated summary

Vikas_Dangi reported that orphan images uploaded to Amazon S3 were not being automatically removed, despite having the ‘Remove orphan unreferenced uploads’ setting enabled. codinghorror initially suggested S3 cleanup might not be supported, but zogstrip clarified that orphan cleanup should work for both local and S3 storage, with S3 tombstone cleanup handled automatically via policy. Vikas_Dangi confirmed the ‘clean_up_uploads’ setting was enabled with a 1-hour grace period and insisted the image was unused (not in posts, avatars, or profiles). Mittineague questioned how the image was uploaded — Vikas_Dangi explained it was via the composer’s upload button but the post was canceled, leaving the image orphaned in a draft. Mittineague suspected the image remained in the draft state, preventing cleanup. Vikas_Dangi confirmed the image persisted on S3 despite this. Eventually, Vikas_Dangi reported the issue resolved, though no specific fix was detailed. The discussion highlights potential confusion around draft uploads and S3 orphan cleanup behavior, with cleanup logic depending on whether the upload is truly unreferenced or retained in draft state.

Remove orphan unreferenced uploads is checked in my forum but still the orphan images are not removing automatically.

To check this I have uploaded a images yesterday to my forum but still it is accessible.

defenceforum-img-s3.s3-ap-south-1.amazonaws.com/original/1X/b2597229c427eead298ccb553a44ce92c2190e28.jpg

I don’t think we remove from S3, just local.

Then how can I protect my s3 from illegal hosting

Cleaning up orphan uploads should work for both local and S3 storages.

The only difference between the local and S3 storages is that the cleanup of the tombstone is automatically handled by S3 via a policy.

@Vikas_Dangi have you enabled the clean_up_uploads site setting? Are you sure that image isn’t used somewhere else (avatar, user profile, category image, etc..)?

Yes the clean up upload is enabled and the grace period hours is set to 1. But the images are still not removing.

I have uploaded the image to just check the functionality, so i have not used the image in any post, avatar or other.

I’m not understanding. You uploaded but didn’t use?
How did you upload it?

I have uploaded it through upload button. But didn’t posted it in the topic, so it became orphan image. But my problem is that the orphaned imaged not removing automatically.

Correct me if I’m wrong.

  • you opened the composer
  • you uploaded the image via the upload icon
  • then canceled the post

i.e. The image is not being removed from the Draft

Yes your 3 points are correct. But the image is not removing from the s3 server.

now its working thanks.