C++ API graceful handling of MAGICK_TMPDIR becoming full
Posted: 2017-09-22T02:45:20-07:00
I have a C++ process on Linux that processes a large number of images - when TMPDIR / MAGICK_TMPDIR is full the process crashes with SIGBUS
I can make this situation appear more readily by creating a small 1MB tmpfs filesystem and pointing MAGICK_TMPDIR at it - the crash/output is produced with that setup
At frame 5
the size of buffer provided is 4,296,964 bytes so not large/inline with the last several hundred images that were processed.
Is there a recommended way to trap and handle the condition whereby ImageMagick fails with generating its tmp files in TMPDIR/MAGICK_TMPDIR locations?
Using ImageMagick 6.9.9-13 Q16 on Fedora26 (from their official repos)
I can make this situation appear more readily by creating a small 1MB tmpfs filesystem and pointing MAGICK_TMPDIR at it - the crash/output is produced with that setup
Code: Select all
Thread 1066 "imgcat" received signal SIGBUS, Bus error.
[Switching to Thread 0x7fff6ae31700 (LWP 9427)]
0x00007fffbddf561e in ReadJPEGImage () from /usr/lib64/ImageMagick-6.9.9/modules-Q16/coders/jpeg.so
(gdb) where
#0 0x00007fffbddf561e in ReadJPEGImage () from /usr/lib64/ImageMagick-6.9.9/modules-Q16/coders/jpeg.so
#1 0x00007ffff73f396e in ReadImage () from /lib64/libMagickCore-6.Q16.so.5
#2 0x00007ffff73be7a0 in BlobToImage () from /lib64/libMagickCore-6.Q16.so.5
#3 0x00007ffff7bb1107 in Magick::Image::read(Magick::Blob const&) () from /lib64/libMagick++-6.Q16.so.8
#4 0x00007ffff7bb1169 in Magick::Image::Image(Magick::Blob const&) () from /lib64/libMagick++-6.Q16.so.8
#5 0x000000000041db18 in ImgThumbGen::_genthumbnail (this=0xb726e0, path_=".thumbs/6091047-6450.jpg",
Code: Select all
Magick::Image img(Magick::Blob( preview_.pData(), preview_.size() ));
Is there a recommended way to trap and handle the condition whereby ImageMagick fails with generating its tmp files in TMPDIR/MAGICK_TMPDIR locations?
Using ImageMagick 6.9.9-13 Q16 on Fedora26 (from their official repos)