'magick-*' files increase disk space on Image::resize hang or failure

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Ganesh_B
Posts: 9
Joined: 2018-03-06T05:29:40-07:00
Authentication code: 1152

'magick-*' files increase disk space on Image::resize hang or failure

Post by Ganesh_B » 2018-12-07T02:34:19-07:00

Hi ImageMagick,

Our Customer has raised issue that disk space is increasing continuously in huge amounts as ‘magick-*’ temporary files in ‘C:\Windows\Temp’ are not cleaned up after failure at conversion of attached file(link below).

https://drive.google.com/open?id=1jOuSs ... G-DSvebNpZ

The attached image file(link below) conversion is hanging when opened/read using ImageMagick’s C++ ‘class MagickPPExport Image’ and when method ‘Image::resize()’ called with argument as ‘7968x10968!’ calculated for output resolution 300 Text content. This is happening even with the latest version of ImageMagick ie; ‘ImageMagick-7.0.8-12’.

Is there any facility/configuration to clean-up temporary files even after hang or failures at ImageMagick conversions. What could be the reason for hang/failure of this particular image.

https://drive.google.com/open?id=1jOuSs ... G-DSvebNpZ

Regards,
Ganesh.

snibgo
Posts: 10929
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: 'magick-*' files increase disk space on Image::resize hang or failure

Post by snibgo » 2018-12-07T06:20:19-07:00

What version of IM?

My guess is that you had a failure that IM couldn't recover from (perhaps out of memory), so it crashed or was killed by the OS, so didn't have a chance to delete its temporary files.

The cure is to regularly delete files in %TEMP%.

Other software also leaves files in %TEMP%. You might want to delete all files in that directory whenever you startup or shutdown.
snibgo's IM pages: im.snibgo.com

Ganesh_B
Posts: 9
Joined: 2018-03-06T05:29:40-07:00
Authentication code: 1152

Re: 'magick-*' files increase disk space on Image::resize hang or failure

Post by Ganesh_B » 2018-12-09T23:44:37-07:00

Hi
ImageMagick version is 'ImageMagick-7.0.8-12'. What is the reason for the attached image hang for several minutes( more than 60 mn) issue at method ‘Image::resize()’ called with argument as ‘7968x10968!’ ? Can there be a resolution by IM.

https://drive.google.com/open?id=1jOuSs ... G-DSvebNpZ

Regards,
Ganesh.

snibgo
Posts: 10929
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: 'magick-*' files increase disk space on Image::resize hang or failure

Post by snibgo » 2018-12-10T01:40:44-07:00

Your operating system contains tools to monitor memory and disk access by processes. What do they tell you? Perhaps your operation needs more memory than you have available, so IM uses disk for pixel caches. Disk is far slower than memory.

How many pixels does the input image have?

How much physical memory do you have? Perhaps you have enough, but IM isn't using it all. What does "magick list resource" say? Perhaps your policy.xml is too restrictive.
snibgo's IM pages: im.snibgo.com

User avatar
magick
Site Admin
Posts: 10861
Joined: 2003-05-31T11:32:55-07:00

Re: 'magick-*' files increase disk space on Image::resize hang or failure

Post by magick » 2018-12-10T04:09:18-07:00

Read about ImageMagick architecture @ https://www.imagemagick.org/script/architecture.php. Read about large image support @ https://www.imagemagick.org/script/arch ... tera-pixel. Its likely the image size exceeds the available memory. If so, the image pixels are cached to disk which is quite slow. To speed up the process by up to 5X, IM utilizes memory-mapped IO on disk. The default disk partition is /tmp. If it fills up while being memory-mapped, a SIGBUS is thrown. IM cannot catch a SIGBUS so any temporary files it creates cannot be gracefully removed. Instead set the MAGICK_SYNCHRONIZE environment variable, see https://www.imagemagick.org/script/resources.php, which will permit IM to exit gracefully if it runs out of disk space with a slight performance penalty. Alternatively, choose a different disk partition to cache the image pixels per https://www.imagemagick.org/script/arch ... tera-pixel. Finally, consider getting a beefier host. With plenty of memory, cores, disk and fast disk, ImageMagick will perform operations in seconds rather than minutes. On our host with 32GB of memory and 8 cores, we resized your image in less than 2 seconds.

Post Reply