Page 1 of 1

Crash on lack of space in /tmp

Posted: 2013-10-24T09:26:00-07:00
by Hubbitus
https://bugzilla.redhat.com/show_bug.cgi?id=1006658

This thread have lot of irrelevant comment, but please concern one, citing:
Should convert crash if there isn't sufficient space in /tmp for it's operation (no matter where /tmp is actually mounted?) - No. That's a bug. convert should detect a lack of space and fail gracefully - cleaning up any files that had been created along the way.
Could it be checked please? It will be extremely usable.

Re: Crash on lack of space in /tmp

Posted: 2013-10-24T09:39:04-07:00
by snibgo
It is also possible for convert to run out of tmp space, create an incorrect image, and not fail. In my view, this is worse than crashing.

Re: Crash on lack of space in /tmp

Posted: 2013-10-24T16:28:48-07:00
by magick
The solution to this problem is to add -synchronize to the command line. This option ensures that disk space allocated to the pixel cache exists before any pixels are written (see posix_fallocate(3)). Without it, the pixel cache sets the disk extent but does not preallocate the disk for performance reasons. When the disk-based pixel cache is memory-mapped, again for for performance reasons, the OS issues a SIGBUS if not enough disk is available. This behavior is not specific to ImageMagick. It is expected in any program that memory-maps a disk file that is not fully populated and subsequently runs out of disk on the device (see http://www.linuxprogrammingblog.com/cod ... S-handling for a similar mmap() issue).

With -synchronize you will see a slow down in performance for any image that requires more memory than the system can provide. However, ImageMagick will exit gracefully.

We used to catch the SIGBUS signal but it proved problematic. We will revisit catching the SIGBUS and see if we can come up with a reasonable way to exit ImageMagick gracefully.

Re: Crash on lack of space in /tmp

Posted: 2013-10-25T02:47:28-07:00
by snibgo
Thanks. "-synchronize" is documented: http://www.imagemagick.org/script/comma ... ynchronize