4meg image creates multi-gigabyte temp file & crashes
Posted: 2012-09-18T07:02:13-07:00
I process lots of images. Last week I was trying to create thumbnails for about 3.2 million PNG line art images. Most of these images are fairly small in size (they are bi-toanl, and in the 10's of k). I wrote a script to convert the images. It kept crashing. At first, I thought it was something with my bash script (which walked the directories & used convert). So I rewrote to use mogrify on a per-directory basis, and the same thing happened.
Upon investigation, what is/was happing is that there would be an image that would create these mulit-gigabyte tmp files, filling the file system, and the kernel would kill the process. I was able to find several of these images. One of them, a 4meg PNG, when I simply use identify, creates a temp file:
-rw------- 1 bv6679 23903448660 Sep 18 09:56 /tmp/magick-RaU0gd0O
and the command just stalls (it does not return any output).
I've do doubt these images are corrupt. But how am I to know that an image is corrupt before this happens? When the OS kills the process, the temp file is left behind, so I'm not even sure I could write a script to moniter for this behaviour.
This seems a very serious defect to me. I've searched for similar issues, and I find refernece to them, but, not to this exact one. I've tried IM versions from 6.2 up through the current 6.7, and they all behave this way.
Upon investigation, what is/was happing is that there would be an image that would create these mulit-gigabyte tmp files, filling the file system, and the kernel would kill the process. I was able to find several of these images. One of them, a 4meg PNG, when I simply use identify, creates a temp file:
-rw------- 1 bv6679 23903448660 Sep 18 09:56 /tmp/magick-RaU0gd0O
and the command just stalls (it does not return any output).
I've do doubt these images are corrupt. But how am I to know that an image is corrupt before this happens? When the OS kills the process, the temp file is left behind, so I'm not even sure I could write a script to moniter for this behaviour.
This seems a very serious defect to me. I've searched for similar issues, and I find refernece to them, but, not to this exact one. I've tried IM versions from 6.2 up through the current 6.7, and they all behave this way.