Mike
Mike

Reputation: 440

Spatie Media Library is creating tmp files that crashed my server

My app was throwing this error in Sentry over and over likely from a user trying to upload a certain image:

"Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files."

It says Processing Queue Job and shows this queued job attempting over 33,000 times

{ attempts: 33832, connection: redis, job: Illuminate\Queue\CallQueuedHandler@call, queue: default, resolved: Spatie\MediaLibrary\Jobs\PerformConversions }

select * from media where media.id = ? limit 1 { bindings: [ 27877 ], connectionName: mysql, executionTimeMs: 0.49 }

This issue caused over 30,000 tmp folders containing the image to be added to /storage/medialibrary/temp which took up almost 200 gb and 100% of my disk space.

What can I do to prevent this in the future? I restarted my server but it didn't stop this queued job. How would I go about stopping a job like this that attempts to execute over and over again? I've since just deleted that record in the media table and it stopped, but it feels like not the right solution.

Upvotes: 0

Views: 1159

Answers (0)

Related Questions