Large Temporary Files Left Behind by ImageMagick

Recently since moving the CSS Sprite Generator to a new server we've had a couple of cases where the site has stopped working due to running out of disk-space.

The cause was due to some epic temporary files being left behind by ImageMagick:

-rw-------  2.7G Nov  1 10:25 magick-XX27JoRr
-rw-------  3.8G Nov  1 08:49 magick-XX3Ta6P6
-rw-------  1.7G Nov  1 07:22 magick-XX8uxqCS
-rw-------  3.8G Nov  1 08:54 magick-XXzm6nUD

I decided to up the max-execution_time in php.ini as I'd seem some comments that if the processes interacting with imagick are interrupted it can cause the temporary files to not be cleaned up.

max_execution_time = 120

In our case we're using the imagick library for PHP, but it's worth bearing in mind that this problem could potentially occur with any other interface to the ImageMagick libaries.

Since doing this, the problem has not re-appeared.

Show Comments