convert crashes in memcpy on CentOS 6.6

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.
djbcmp
Posts: 8
Joined: 2015-02-05T08:20:54-07:00
Authentication code: 6789

convert crashes in memcpy on CentOS 6.6

Post by djbcmp »

Our MediaWiki site (CentOS 6.6 Final) runs /usr/bin/convert behind the scenes to generate thumbnails in the standard MediaWiki way. Intermittently, convert crashes. Here is an example command and the gdb backtrace from the crash:

Code: Select all

/usr/bin/convert -quality 80 -background white /some/path/w/images/c/c4/2014_Public_Creative_Calendar.jpg -thumbnail 89x120! -set comment 'File source: http://example.com/wiki/File:2014_Public_Creative_Calendar.jpg' -depth 8 -sharpen 0x0.4 -rotate -0 /tmp/transform_7e55c77fcada-1.jpg
The error is:
Process /usr/bin/convert was killed by signal 11 (SIGSEGV)

In /var/log/messages:
kernel: convert[30455]: segfault at 2974248 ip 0000003a3b889aab sp 00007fff284dd6e8 error
4 in libc-2.12.so[3a3b800000+18b000]

If I run the command by hand, it succeeds. Convert version is:
$ convert --version
Version: ImageMagick 6.5.4-7 2014-02-10 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC


GDB backtrace:

Code: Select all

$ gdb /usr/bin/convert core
(gdb) bt
#0  memcpy () at ../sysdeps/x86_64/memcpy.S:267
#1  0x00000035fe847d5d in CloneMemoryToMemoryPixelCache (clone_info=0x7ffe1c010600, 
    cache_info=<value optimized out>, exception=0x7ffe1c00f6f8) at magick/cache.c:1218
#2  ClonePixelCache (clone_info=0x7ffe1c010600, cache_info=<value optimized out>, exception=0x7ffe1c00f6f8)
    at magick/cache.c:1239
#3  0x00000035fe84a15e in GetImagePixelCache (image=0x7ffe1c00c480, clone=MagickTrue, exception=0x7ffe1c00f6f8)
    at magick/cache.c:2076
#4  0x00000035fe8e3237 in SetImageExtent (image=<value optimized out>, columns=<value optimized out>, 
    rows=<value optimized out>) at magick/image.c:3341
#5  0x00000035fe8e47d0 in CloneImage (image=0x188a450, columns=445, rows=600, detach=MagickTrue, 
    exception=0x186df40) at magick/image.c:1147
#6  0x00000035fe92c8b6 in SampleImage (image=0x188a450, columns=445, rows=600, exception=0x186df40)
    at magick/resize.c:2314
#7  0x00000035fe92ef97 in ThumbnailImage (image=0x188a450, columns=89, rows=120, exception=0x186df40)
    at magick/resize.c:2908
#8  0x00000035fe0ac465 in MogrifyImage (image_info=0x1874d70, argc=16, argv=<value optimized out>, 
    image=<value optimized out>, exception=0x186df40) at wand/mogrify.c:3040
#9  0x00000035fe0b1615 in MogrifyImages (image_info=0x1874d70, post=MagickTrue, argc=16, argv=0x186efd8, 
    images=0x7fff57774dc8, exception=0x186df40) at wand/mogrify.c:7981
#10 0x00000035fe0417d2 in ConvertImageCommand (image_info=0x1874d70, argc=<value optimized out>, argv=0x186efd0, 
    metadata=0x0, exception=<value optimized out>) at wand/convert.c:2801
#11 0x0000000000400dab in main (argc=18, argv=0x7fff577751a8) at utilities/convert.c:122
Other info from "abrt":

Code: Select all

dso_list:
:/lib64/libbz2.so.1.0.4 bzip2-libs-1.0.5-7.el6_0.x86_64 (CentOS) 1397758668
:/usr/lib64/libxcb.so.1.1.0 libxcb-1.9.1-2.el6.x86_64 (CentOS) 1420732309
:/usr/lib64/libMagickCore.so.2.0.0 ImageMagick-6.5.4.7-7.el6_5.x86_64 (CentOS) 1398972178
:/usr/lib64/libtiff.so.3.9.4 libtiff-3.9.4-10.el6_5.x86_64 (CentOS) 1397758673
:/usr/lib64/liblcms.so.1.0.19 lcms-libs-1.19-1.el6.x86_64 (CentOS) 1398972139
:/usr/lib64/libltdl.so.7.2.1 libtool-ltdl-2.2.6-15.5.el6.x86_64 (CentOS) 1398972165
:/usr/lib64/libSM.so.6.0.1 libSM-1.2.1-2.el6.x86_64 (CentOS) 1397758690
:/usr/lib64/libfontconfig.so.1.4.4 fontconfig-2.8.0-5.el6.x86_64 (CentOS) 1420732288
:/lib64/libexpat.so.1.5.2 expat-2.0.1-11.el6_2.x86_64 (CentOS) 1397758670 :/lib64/libm-2.12.so glibc-2.12-1.149.el6.x86_64 (CentOS) 1420732269 :/usr/lib64/gconv/gconv-modules.cache glibc-2.12-1.149.el6.x86_64 (CentOS) 1420732269
:/usr/lib64/libX11.so.6.3.0 libX11-1.6.0-2.2.el6.x86_64 (CentOS) 1420732349 :/lib64/libdl-2.12.so glibc-2.12-1.149.el6.x86_64 (CentOS) 1420732269 :/lib64/libc-2.12.so glibc-2.12-1.149.el6.x86_64 (CentOS) 1420732269
:/lib64/libuuid.so.1.3.0 libuuid-2.17.2-12.18.el6.x86_64 (CentOS) 1420732293
:/usr/lib64/libfreetype.so.6.3.22 freetype-2.3.11-14.el6_3.1.x86_64 (CentOS) 1397758670
:/usr/lib64/libICE.so.6.3.0 libICE-1.0.6-1.el6.x86_64 (CentOS) 1397758687 :/usr/bin/convert ImageMagick-6.5.4.7-7.el6_5.x86_64 (CentOS) 1398972178
:/usr/lib64/libgomp.so.1.0.0 libgomp-4.4.7-11.el6.x86_64 (CentOS) 1420732309
:/lib64/libz.so.1.2.3 zlib-1.2.3-29.el6.x86_64 (CentOS) 1397758667 :/usr/lib64/ImageMagick-6.5.4/modules-Q16/coders/jpeg.so ImageMagick-6.5.4.7-7.el6_5.x86_64 (CentOS) 1398972178
:/usr/lib64/libXext.so.6.4.0 libXext-1.3.2-2.1.el6.x86_64 (CentOS) 1420732349
:/usr/lib64/libjpeg.so.62.0.0 libjpeg-turbo-1.2.1-3.el6_5.x86_64 (CentOS) 1397758671 :/lib64/ld-2.12.so glibc-2.12-1.149.el6.x86_64 (CentOS) 1420732269 :/usr/lib/locale/locale-archive glibc-common-2.12-1.149.el6.x86_64 (CentOS) 1420732280 :/lib64/librt-2.12.so glibc-2.12-1.149.el6.x86_64 (CentOS) 1420732269
:/usr/lib64/libXt.so.6.0.0 libXt-1.1.4-6.1.el6.x86_64 (CentOS) 1420732377
:/usr/lib64/libMagickWand.so.2.0.0 ImageMagick-6.5.4.7-7.el6_5.x86_64 (CentOS) 1398972178
:/lib64/libgcc_s-4.4.7-20120601.so.1 libgcc-4.4.7-11.el6.x86_64 (CentOS) 1420732265 :/lib64/libpthread-2.12.so glibc-2.12-1.149.el6.x86_64 (CentOS) 1420732269
:/usr/lib64/libXau.so.6.0.0 libXau-1.0.6-4.el6.x86_64 (CentOS) 1397758687

environ:
:OMP_NUM_THREADS=1
:TERM=xterm
:PATH=/sbin:/usr/sbin:/bin:/usr/bin
:_=/usr/bin/convert
:KRB5RCACHETYPE=none
:PWD=/mnt/kmwiki/vistawiki/w
:LANG=C
:TZ=America/New_York
:SHLVL=5
:LC_CTYPE=en_US.utf8

limits:
:Limit                     Soft Limit           Hard Limit           Units     
:Max cpu time              180                  180                  seconds   
:Max file size             104857600            104857600            bytes     
:Max data size             unlimited            unlimited            bytes     
:Max stack size            10485760             unlimited            bytes     
:Max core file size        0                    unlimited            bytes     
:Max resident set          unlimited            unlimited            bytes     
:Max processes             46644                46644                processes 
:Max open files            1024                 4096                 files     
:Max locked memory         65536                65536                bytes     
:Max address space         314572800            314572800            bytes     
:Max file locks            unlimited            unlimited            locks     
:Max pending signals       46644                46644                signals   
:Max msgqueue size         819200               819200               bytes     
:Max nice priority         0                    0                    
:Max realtime priority     0                    0                    
:Max realtime timeout      unlimited            unlimited            us        

maps:
:00400000-00402000 r-xp 00000000 fd:03 3292                               /usr/bin/convert
:00601000-00604000 rw-p 00001000 fd:03 3292                               /usr/bin/convert
:00fe5000-01058000 rw-p 00000000 00:00 0                                  [heap]
:3d60c00000-3d60c20000 r-xp 00000000 fd:00 524                            /lib64/ld-2.12.so
:3d60e1f000-3d60e20000 r--p 0001f000 fd:00 524                            /lib64/ld-2.12.so
:3d60e20000-3d60e21000 rw-p 00020000 fd:00 524                            /lib64/ld-2.12.so
:3d60e21000-3d60e22000 rw-p 00000000 00:00 0 
:3d61000000-3d6118a000 r-xp 00000000 fd:00 526                            /lib64/libc-2.12.so
:3d6118a000-3d6138a000 ---p 0018a000 fd:00 526                            /lib64/libc-2.12.so
:3d6138a000-3d6138e000 r--p 0018a000 fd:00 526                            /lib64/libc-2.12.so
:3d6138e000-3d6138f000 rw-p 0018e000 fd:00 526                            /lib64/libc-2.12.so
:3d6138f000-3d61394000 rw-p 00000000 00:00 0 
:3d61400000-3d61483000 r-xp 00000000 fd:00 542                            /lib64/libm-2.12.so
:3d61483000-3d61682000 ---p 00083000 fd:00 542                            /lib64/libm-2.12.so
:3d61682000-3d61683000 r--p 00082000 fd:00 542                            /lib64/libm-2.12.so
:3d61683000-3d61684000 rw-p 00083000 fd:00 542                            /lib64/libm-2.12.so
:3d61800000-3d61802000 r-xp 00000000 fd:00 560                            /lib64/libdl-2.12.so
:3d61802000-3d61a02000 ---p 00002000 fd:00 560                            /lib64/libdl-2.12.so
:3d61a02000-3d61a03000 r--p 00002000 fd:00 560                            /lib64/libdl-2.12.so
:3d61a03000-3d61a04000 rw-p 00003000 fd:00 560                            /lib64/libdl-2.12.so
:3d61c00000-3d61c17000 r-xp 00000000 fd:00 528                            /lib64/libpthread-2.12.so
:3d61c17000-3d61e17000 ---p 00017000 fd:00 528                            /lib64/libpthread-2.12.so
:3d61e17000-3d61e18000 r--p 00017000 fd:00 528                            /lib64/libpthread-2.12.so
:3d61e18000-3d61e19000 rw-p 00018000 fd:00 528                            /lib64/libpthread-2.12.so
:3d61e19000-3d61e1d000 rw-p 00000000 00:00 0 
:3d62000000-3d62015000 r-xp 00000000 fd:00 705                            /lib64/libz.so.1.2.3
:3d62015000-3d62214000 ---p 00015000 fd:00 705                            /lib64/libz.so.1.2.3
:3d62214000-3d62215000 r--p 00014000 fd:00 705                            /lib64/libz.so.1.2.3
:3d62215000-3d62216000 rw-p 00015000 fd:00 705                            /lib64/libz.so.1.2.3
:3d62400000-3d62407000 r-xp 00000000 fd:00 463                            /lib64/librt-2.12.so
:3d62407000-3d62606000 ---p 00007000 fd:00 463                            /lib64/librt-2.12.so
:3d62606000-3d62607000 r--p 00006000 fd:00 463                            /lib64/librt-2.12.so
:3d62607000-3d62608000 rw-p 00007000 fd:00 463                            /lib64/librt-2.12.so
:3d63400000-3d63416000 r-xp 00000000 fd:00 543                            /lib64/libgcc_s-4.4.7-20120601.so.1
:3d63416000-3d63615000 ---p 00016000 fd:00 543                            /lib64/libgcc_s-4.4.7-20120601.so.1
:3d63615000-3d63616000 rw-p 00015000 fd:00 543                            /lib64/libgcc_s-4.4.7-20120601.so.1
:3d65400000-3d65426000 r-xp 00000000 fd:00 5058                           /lib64/libexpat.so.1.5.2
:3d65426000-3d65625000 ---p 00026000 fd:00 5058                           /lib64/libexpat.so.1.5.2
:3d65625000-3d65628000 rw-p 00025000 fd:00 5058                           /lib64/libexpat.so.1.5.2
:3d66400000-3d6643f000 r-xp 00000000 fd:03 3497                           /usr/lib64/libjpeg.so.62.0.0
:3d6643f000-3d6663f000 ---p 0003f000 fd:03 3497                           /usr/lib64/libjpeg.so.62.0.0
:3d6663f000-3d66640000 rw-p 0003f000 fd:03 3497                           /usr/lib64/libjpeg.so.62.0.0
:3d66640000-3d66650000 rw-p 00000000 00:00 0 
:3d67000000-3d6705f000 r-xp 00000000 fd:03 3489                           /usr/lib64/libXt.so.6.0.0
:3d6705f000-3d6725e000 ---p 0005f000 fd:03 3489                           /usr/lib64/libXt.so.6.0.0
:3d6725e000-3d67264000 rw-p 0005e000 fd:03 3489                           /usr/lib64/libXt.so.6.0.0
:3d67264000-3d67265000 rw-p 00000000 00:00 0 
:3d67400000-3d67498000 r-xp 00000000 fd:03 1712                           /usr/lib64/libfreetype.so.6.3.22
:3d67498000-3d67697000 ---p 00098000 fd:03 1712                           /usr/lib64/libfreetype.so.6.3.22
:3d67697000-3d6769d000 rw-p 00097000 fd:03 1712                           /usr/lib64/libfreetype.so.6.3.22
:3d67c00000-3d67c62000 r-xp 00000000 fd:03 3502                           /usr/lib64/libtiff.so.3.9.4
:3d67c62000-3d67e61000 ---p 00062000 fd:03 3502                           /usr/lib64/libtiff.so.3.9.4
:3d67e61000-3d67e64000 rw-p 00061000 fd:03 3502                           /usr/lib64/libtiff.so.3.9.4
:3d68400000-3d68410000 r-xp 00000000 fd:00 1975                           /lib64/libbz2.so.1.0.4
:3d68410000-3d6860f000 ---p 00010000 fd:00 1975                           /lib64/libbz2.so.1.0.4
:3d6860f000-3d68611000 rw-p 0000f000 fd:00 1975                           /lib64/libbz2.so.1.0.4
:3d68800000-3d68804000 r-xp 00000000 fd:00 5434                           /lib64/libuuid.so.1.3.0
:3d68804000-3d68a03000 ---p 00004000 fd:00 5434                           /lib64/libuuid.so.1.3.0
:3d68a03000-3d68a04000 rw-p 00003000 fd:00 5434                           /lib64/libuuid.so.1.3.0
:3d68c00000-3d68c02000 r-xp 00000000 fd:03 2315                           /usr/lib64/libXau.so.6.0.0
:3d68c02000-3d68e02000 ---p 00002000 fd:03 2315                           /usr/lib64/libXau.so.6.0.0
:3d68e02000-3d68e03000 rw-p 00002000 fd:03 2315                           /usr/lib64/libXau.so.6.0.0
:3d6a000000-3d6a137000 r-xp 00000000 fd:03 3488                           /usr/lib64/libX11.so.6.3.0
:3d6a137000-3d6a337000 ---p 00137000 fd:03 3488                           /usr/lib64/libX11.so.6.3.0
:3d6a337000-3d6a33d000 rw-p 00137000 fd:03 3488                           /usr/lib64/libX11.so.6.3.0
:3d6a800000-3d6a834000 r-xp 00000000 fd:03 2995                           /usr/lib64/libfontconfig.so.1.4.4
:3d6a834000-3d6aa34000 ---p 00034000 fd:03 2995                           /usr/lib64/libfontconfig.so.1.4.4
:3d6aa34000-3d6aa36000 rw-p 00034000 fd:03 2995                           /usr/lib64/libfontconfig.so.1.4.4
:3d6ac00000-3d6ac1d000 r-xp 00000000 fd:03 3487                           /usr/lib64/libxcb.so.1.1.0
:3d6ac1d000-3d6ae1d000 ---p 0001d000 fd:03 3487                           /usr/lib64/libxcb.so.1.1.0
:3d6ae1d000-3d6ae1e000 rw-p 0001d000 fd:03 3487                           /usr/lib64/libxcb.so.1.1.0
:3d6b800000-3d6b811000 r-xp 00000000 fd:03 3490                           /usr/lib64/libXext.so.6.4.0
:3d6b811000-3d6ba11000 ---p 00011000 fd:03 3490                           /usr/lib64/libXext.so.6.4.0
:3d6ba11000-3d6ba12000 rw-p 00011000 fd:03 3490                           /usr/lib64/libXext.so.6.4.0
:3d6bc00000-3d6bc09000 r-xp 00000000 fd:03 3535                           /usr/lib64/libltdl.so.7.2.1
:3d6bc09000-3d6be08000 ---p 00009000 fd:03 3535                           /usr/lib64/libltdl.so.7.2.1
:3d6be08000-3d6be09000 rw-p 00008000 fd:03 3535                           /usr/lib64/libltdl.so.7.2.1
:3d6c000000-3d6c017000 r-xp 00000000 fd:03 3486                           /usr/lib64/libICE.so.6.3.0
:3d6c017000-3d6c217000 ---p 00017000 fd:03 3486                           /usr/lib64/libICE.so.6.3.0
:3d6c217000-3d6c218000 rw-p 00017000 fd:03 3486                           /usr/lib64/libICE.so.6.3.0
:3d6c218000-3d6c21c000 rw-p 00000000 00:00 0 
:3d6c400000-3d6c407000 r-xp 00000000 fd:03 1998                           /usr/lib64/libSM.so.6.0.1
:3d6c407000-3d6c607000 ---p 00007000 fd:03 1998                           /usr/lib64/libSM.so.6.0.1
:3d6c607000-3d6c608000 rw-p 00007000 fd:03 1998                           /usr/lib64/libSM.so.6.0.1
:3d6cc00000-3d6cc35000 r-xp 00000000 fd:03 2319                           /usr/lib64/liblcms.so.1.0.19
:3d6cc35000-3d6ce35000 ---p 00035000 fd:03 2319                           /usr/lib64/liblcms.so.1.0.19
:3d6ce35000-3d6ce37000 rw-p 00035000 fd:03 2319                           /usr/lib64/liblcms.so.1.0.19
:3d6ce37000-3d6ce39000 rw-p 00000000 00:00 0 
:3d6d800000-3d6d815000 r-xp 00000000 fd:03 3503                           /usr/lib64/libgomp.so.1.0.0
:3d6d815000-3d6da14000 ---p 00015000 fd:03 3503                           /usr/lib64/libgomp.so.1.0.0
:3d6da14000-3d6da15000 rw-p 00014000 fd:03 3503                           /usr/lib64/libgomp.so.1.0.0
:3d6dc00000-3d6ddce000 r-xp 00000000 fd:03 3686                           /usr/lib64/libMagickCore.so.2.0.0
:3d6ddce000-3d6dfce000 ---p 001ce000 fd:03 3686                           /usr/lib64/libMagickCore.so.2.0.0
:3d6dfce000-3d6e01f000 rw-p 001ce000 fd:03 3686                           /usr/lib64/libMagickCore.so.2.0.0
:3d6e01f000-3d6e038000 rw-p 00000000 00:00 0 
:3d6ea00000-3d6eb08000 r-xp 00000000 fd:03 3631                           /usr/lib64/libMagickWand.so.2.0.0
:3d6eb08000-3d6ed07000 ---p 00108000 fd:03 3631                           /usr/lib64/libMagickWand.so.2.0.0
:3d6ed07000-3d6ed0b000 rw-p 00107000 fd:03 3631                           /usr/lib64/libMagickWand.so.2.0.0
:7f1ca0000000-7f1ca0040000 rw-p 00000000 00:00 0
:7f1ca0040000-7f1ca4000000 ---p 00000000 00:00 0
:7f1cc420a000-7f1cc4414000 rw-p 00000000 00:00 0 
:7f1cc4414000-7f1cc441c000 r-xp 00000000 fd:03 21416                      /usr/lib64/ImageMagick-6.5.4/modules-Q16/coders/jpeg.so
:7f1cc441c000-7f1cc461c000 ---p 00008000 fd:03 21416                      /usr/lib64/ImageMagick-6.5.4/modules-Q16/coders/jpeg.so
:7f1cc461c000-7f1cc461d000 rw-p 00008000 fd:03 21416                      /usr/lib64/ImageMagick-6.5.4/modules-Q16/coders/jpeg.so
:7f1cc461d000-7f1cca4ae000 r--p 00000000 fd:03 1716                       /usr/lib/locale/locale-archive
:7f1cca4ae000-7f1cca4bb000 rw-p 00000000 00:00 0 
:7f1cca4c1000-7f1cca4c8000 r--s 00000000 fd:03 1707                       /usr/lib64/gconv/gconv-modules.cache
:7f1cca4c8000-7f1cca4c9000 rw-p 00000000 00:00 0 
:7fffef760000-7fffef781000 rw-p 00000000 00:00 0                          [stack]
:7fffef7be000-7fffef7bf000 r-xp 00000000 00:00 0                          [vdso]
:ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

open_fds:
:0:/dev/null
:pos:	0
:flags:	0100000
:1:pipe:[4925865]
:pos:	0
:flags:	01
:2:pipe:[4925865]
:pos:	0
:flags:	01
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert crashes in memcpy on CentOS 6.6

Post by magick »

Its very likely, the current ImageMagick release (6.9.0-4) will resolve your crash.
djbcmp
Posts: 8
Joined: 2015-02-05T08:20:54-07:00
Authentication code: 6789

Re: convert crashes in memcpy on CentOS 6.6

Post by djbcmp »

I've discovered that the crashing pictures are all large in resolution, like 8500 x 3500 pixels.

Is there some limit that I need to increase for "convert"? Or for PHP/MediaWiki (the caller)?

Code: Select all

$ convert -list resource
File       Area     Memory        Map       Disk  Thread       Time
-------------------------------------------------------------------
 768   11.416gb   8.5622gb   22.833gb       16eb       1  unlimited
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert crashes in memcpy on CentOS 6.6

Post by magick »

Can you post a link to one of the images that crashes? We'll see if we can reproduce the problem.

By default, ImageMagick writes pixels to memory and if there is not enough, to disk. Typically it writes to /tmp. If /tmp is not big enough and the file is memory mapped, the OS might issue a SIGBUS. You can set the TMPDIR environment variable to redirect where ImageMagick writes its pixel cache.

Post a stack-trace:
  • gdb convert
    run mybigimage null:
    where
djbcmp
Posts: 8
Joined: 2015-02-05T08:20:54-07:00
Authentication code: 6789

Re: convert crashes in memcpy on CentOS 6.6

Post by djbcmp »

I got some better error messages this time:

Error creating thumbnail: convert: unable to extend cache `<path>/myimage.jpg': File too large @ cache.c/OpenPixelCache/3867.

convert: Memory allocation failed `<path>/myimage.jpg' @ shear.c/RotateImage/1961.

convert: Application transferred too few scanlines `<path>/myimage.jpg' @ jpeg.c/EmitMessage/237.

Full stack trace is in the original ticket.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert crashes in memcpy on CentOS 6.6

Post by magick »

You are running out of free space in the default temporary path (e.g. /tmp). Set the MAGICK_TEMPORARY_PATH environment variable to point to a writeable path with plenty of free disk space or use the -define registry:temporary-path=/data/tmp command line option (use a valid path instead of /data/tmp).
djbcmp
Posts: 8
Joined: 2015-02-05T08:20:54-07:00
Authentication code: 6789

Re: convert crashes in memcpy on CentOS 6.6

Post by djbcmp »

You sure? /tmp on my machine has 1 GB of free disk space. The image in question is about 4000 x 3000 pixels.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert crashes in memcpy on CentOS 6.6

Post by magick »

You can add -debug cache to your command line to track the problem. The exception you received means ImageMagick is trying to extend the pixel cache on disk and the system fails to honor the request.

You could try updating your release of ImageMagick. The current release is 6.9.0-6.
ufnms
Posts: 4
Joined: 2015-09-16T07:30:40-07:00
Authentication code: 1151

Re: convert crashes in memcpy on CentOS 6.6

Post by ufnms »

What was the resolution for this issue?

Also, how were the following error messages captured?
djbcmp wrote:Error creating thumbnail: convert: unable to extend cache `<path>/myimage.jpg': File too large @ cache.c/OpenPixelCache/3867.

convert: Memory allocation failed `<path>/myimage.jpg' @ shear.c/RotateImage/1961.

convert: Application transferred too few scanlines `<path>/myimage.jpg' @ jpeg.c/EmitMessage/237.
broucaries
Posts: 467
Joined: 2008-12-21T11:51:10-07:00

Re: convert crashes in memcpy on CentOS 6.6

Post by broucaries »

Could you run the program under vlagrind. Beware it is slow
ufnms
Posts: 4
Joined: 2015-09-16T07:30:40-07:00
Authentication code: 1151

Re: convert crashes in memcpy on CentOS 6.6

Post by ufnms »

broucaries wrote:Could you run the program under vlagrind. Beware it is slow
I've never used valgrind. Care to suggest options?
broucaries
Posts: 467
Joined: 2008-12-21T11:51:10-07:00

Re: convert crashes in memcpy on CentOS 6.6

Post by broucaries »

none run it first without option

valgrind
ufnms
Posts: 4
Joined: 2015-09-16T07:30:40-07:00
Authentication code: 1151

Re: convert crashes in memcpy on CentOS 6.6

Post by ufnms »

Code: Select all

==21051== Memcheck, a memory error detector
==21051== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==21051== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==21051== Command: convert
==21051== 
Version: ImageMagick 6.7.2-7 2015-02-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP    

Usage: convert [options ...] file [ [options ...] file ...] [options ...] file

Image Settings:
  -adjoin              join images into a single multi-image file
  -affine matrix       affine transform matrix
  -alpha option        activate, deactivate, reset, or set the alpha channel
  -antialias           remove pixel-aliasing
  -authenticate password
                       decipher image with this password
  -attenuate value     lessen (or intensify) when adding noise to an image
  -background color    background color
  -bias value          add bias when convolving an image
  -black-point-compensation
                       use black point compensation
  -blue-primary point  chromaticity blue primary point
  -bordercolor color   border color
  -caption string      assign a caption to an image
  -channel type        apply option to select image channels
  -colors value        preferred number of colors in the image
  -colorspace type     alternate image colorspace
  -comment string      annotate image with comment
  -compose operator    set image composite operator
  -compress type       type of pixel compression when writing the image
  -define format:option
                       define one or more image format options
  -delay value         display the next image after pausing
  -density geometry    horizontal and vertical density of the image
  -depth value         image depth
  -direction type      render text right-to-left or left-to-right
  -display server      get image or font from this X server
  -dispose method      layer disposal method
  -dither method       apply error diffusion to image
  -encoding type       text encoding type
  -endian type         endianness (MSB or LSB) of the image
  -family name         render text with this font family
  -fill color          color to use when filling a graphic primitive
  -filter type         use this filter when resizing an image
  -font name           render text with this font
  -format "string"     output formatted image characteristics
  -fuzz distance       colors within this distance are considered equal
  -gravity type        horizontal and vertical text placement
  -green-primary point chromaticity green primary point
  -intent type         type of rendering intent when managing the image color
  -interlace type      type of image interlacing scheme
  -interline-spacing value
                       set the space between two text lines
  -interpolate method  pixel color interpolation method
  -interword-spacing value
                       set the space between two words
  -kerning value       set the space between two letters
  -label string        assign a label to an image
  -limit type value    pixel cache resource limit
  -loop iterations     add Netscape loop extension to your GIF animation
  -mask filename       associate a mask with the image
  -mattecolor color    frame color
  -monitor             monitor progress
  -orient type         image orientation
  -page geometry       size and location of an image canvas (setting)
  -ping                efficiently determine image attributes
  -pointsize value     font point size
  -precision value     maximum number of significant digits to print
  -preview type        image preview type
  -quality value       JPEG/MIFF/PNG compression level
  -quiet               suppress all warning messages
  -red-primary point   chromaticity red primary point
  -regard-warnings     pay attention to warning messages
  -remap filename      transform image colors to match this set of colors
  -respect-parentheses settings remain in effect until parenthesis boundary
  -sampling-factor geometry
                       horizontal and vertical sampling factor
  -scene value         image scene number
  -seed value          seed a new sequence of pseudo-random numbers
  -size geometry       width and height of image
  -stretch type        render text with this font stretch
  -stroke color        graphic primitive stroke color
  -strokewidth value   graphic primitive stroke width
  -style type          render text with this font style
  -synchronize         synchronize image to storage device
  -taint               declare the image as modified
  -texture filename    name of texture to tile onto the image background
  -tile-offset geometry
                       tile offset
  -treedepth value     color tree depth
  -transparent-color color
                       transparent color
  -undercolor color    annotation bounding box color
  -units type          the units of image resolution
  -verbose             print detailed information about the image
  -view                FlashPix viewing transforms
  -virtual-pixel method
                       virtual pixel access method
  -weight type         render text with this font weight
  -white-point point   chromaticity white point

Image Operators:
  -adaptive-blur geometry
                       adaptively blur pixels; decrease effect near edges
  -adaptive-resize geometry
                       adaptively resize image using 'mesh' interpolation
  -adaptive-sharpen geometry
                       adaptively sharpen pixels; increase effect near edges
  -alpha option        on, activate, off, deactivate, set, opaque, copy
                       transparent, extract, background, or shape
  -annotate geometry text
                       annotate the image with text
  -auto-gamma          automagically adjust gamma level of image
  -auto-level          automagically adjust color levels of image
  -auto-orient         automagically orient (rotate) image
  -bench iterations    measure performance
  -black-threshold value
                       force all pixels below the threshold into black
  -blue-shift factor   simulate a scene at nighttime in the moonlight
  -blur geometry       reduce image noise and reduce detail levels
  -border geometry     surround image with a border of color
  -bordercolor color   border color
  -brightness-contrast geometry
                       improve brightness / contrast of the image
  -cdl filename        color correct with a color decision list
  -charcoal radius     simulate a charcoal drawing
  -chop geometry       remove pixels from the image interior
  -clamp               restrict pixel range from 0 to the quantum depth
  -clip                clip along the first path from the 8BIM profile
  -clip-mask filename  associate a clip mask with the image
  -clip-path id        clip along a named path from the 8BIM profile
  -colorize value      colorize the image with the fill color
  -color-matrix matrix apply color correction to the image
  -contrast            enhance or reduce the image contrast
  -contrast-stretch geometry
                       improve contrast by `stretching' the intensity range
  -convolve coefficients
                       apply a convolution kernel to the image
  -cycle amount        cycle the image colormap
  -decipher filename   convert cipher pixels to plain pixels
  -deskew threshold    straighten an image
  -despeckle           reduce the speckles within an image
  -distort method args
                       distort images according to given method ad args
  -draw string         annotate the image with a graphic primitive
  -edge radius         apply a filter to detect edges in the image
  -encipher filename   convert plain pixels to cipher pixels
  -emboss radius       emboss an image
  -enhance             apply a digital filter to enhance a noisy image
  -equalize            perform histogram equalization to an image
  -evaluate operator value
                       evaluate an arithmetic, relational, or logical expression
  -extent geometry     set the image size
  -extract geometry    extract area from image
  -fft                 implements the discrete Fourier transform (DFT)
  -flip                flip image vertically
  -floodfill geometry color
                       floodfill the image with color
  -flop                flop image horizontally
  -frame geometry      surround image with an ornamental border
  -function name parameters
                       apply function over image values
  -gamma value         level of gamma correction
  -gaussian-blur geometry
                       reduce image noise and reduce detail levels
  -geometry geometry   preferred size or location of the image
  -identify            identify the format and characteristics of the image
  -ift                 implements the inverse discrete Fourier transform (DFT)
  -implode amount      implode image pixels about the center
  -lat geometry        local adaptive thresholding
  -layers method       optimize, merge,  or compare image layers
  -level value         adjust the level of image contrast
  -level-colors color,color
                       level image with the given colors
  -linear-stretch geometry
                       improve contrast by `stretching with saturation'
  -liquid-rescale geometry
                       rescale image with seam-carving
  -median geometry     apply a median filter to the image
  -mode geometry       make each pixel the 'predominant color' of the neighborhood
  -modulate value      vary the brightness, saturation, and hue
  -monochrome          transform image to black and white
  -morphology method kernel
                       apply a morphology method to the image
  -motion-blur geometry
                       simulate motion blur
  -negate              replace every pixel with its complementary color 
  -noise geometry      add or reduce noise in an image
  -normalize           transform image to span the full range of colors
  -opaque color        change this color to the fill color
  -ordered-dither NxN
                       add a noise pattern to the image with specific
                       amplitudes
  -paint radius        simulate an oil painting
  -polaroid angle      simulate a Polaroid picture
  -posterize levels    reduce the image to a limited number of color levels
  -profile filename    add, delete, or apply an image profile
  -quantize colorspace reduce colors in this colorspace
  -radial-blur angle   radial blur the image
  -raise value         lighten/darken image edges to create a 3-D effect
  -random-threshold low,high
                       random threshold the image
  -region geometry     apply options to a portion of the image
  -render              render vector graphics
  -repage geometry     size and location of an image canvas
  -resample geometry   change the resolution of an image
  -resize geometry     resize the image
  -roll geometry       roll an image vertically or horizontally
  -rotate degrees      apply Paeth rotation to the image
  -sample geometry     scale image with pixel sampling
  -scale geometry      scale the image
  -segment values      segment an image
  -selective-blur geometry
                       selectively blur pixels within a contrast threshold
  -sepia-tone threshold
                       simulate a sepia-toned photo
  -set property value  set an image property
  -shade degrees       shade the image using a distant light source
  -shadow geometry     simulate an image shadow
  -sharpen geometry    sharpen the image
  -shave geometry      shave pixels from the image edges
  -shear geometry      slide one edge of the image along the X or Y axis
  -sigmoidal-contrast geometry
                       increase the contrast without saturating highlights or shadows
  -sketch geometry     simulate a pencil sketch
  -solarize threshold  negate all pixels above the threshold level
  -sparse-color method args
                       fill in a image based on a few color points
  -splice geometry     splice the background color into the image
  -spread radius       displace image pixels by a random amount
  -statistic type geometry
                       replace each pixel with corresponding statistic from the neighborhood
  -strip               strip image of all profiles and comments
  -swirl degrees       swirl image pixels about the center
  -threshold value     threshold the image
  -thumbnail geometry  create a thumbnail of the image
  -tile filename       tile image when filling a graphic primitive
  -tint value          tint the image with the fill color
  -transform           affine transform image
  -transparent color   make this color transparent within the image
  -transpose           flip image vertically and rotate 90 degrees
  -transverse          flop image horizontally and rotate 270 degrees
  -trim                trim image edges
  -type type           image type
  -unique-colors       discard all but one of any pixel color
  -unsharp geometry    sharpen the image
  -vignette geometry   soften the edges of the image in vignette style
  -wave geometry       alter an image along a sine wave
  -white-threshold value
                       force all pixels above the threshold into white

Image Sequence Operators:
  -append              append an image sequence
  -clut                apply a color lookup table to the image
  -coalesce            merge a sequence of images
  -combine             combine a sequence of images
  -composite           composite image
  -crop geometry       cut out a rectangular region of the image
  -deconstruct         break down an image sequence into constituent parts
  -evaluate-sequence operator
                       evaluate an arithmetic, relational, or logical expression
  -flatten             flatten a sequence of images
  -fx expression       apply mathematical expression to an image channel(s)
  -hald-clut           apply a Hald color lookup table to the image
  -morph value         morph an image sequence
  -mosaic              create a mosaic from an image sequence
  -print string        interpret string and print to console
  -process arguments   process the image with a custom image filter
  -separate            separate an image channel into a grayscale image
  -smush geometry      smush an image sequence together
  -write filename      write images to this file

Image Stack Operators:
  -clone indexes       clone an image
  -delete indexes      delete the image from the image sequence
  -duplicate count,indexes
                       duplicate an image one or more times
  -insert index        insert last image into the image sequence
  -reverse             reverse image sequence
  -swap indexes        swap two images in the image sequence

Miscellaneous Options:
  -debug events        display copious debugging information
  -help                print program options
  -list type           print a list of supported option arguments
  -log format          format of debugging information
  -version             print version information

By default, the image format of `file' is determined by its magic
number.  To specify a particular image format, precede the filename
with an image format name and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e. image.ps).  Specify 'file' as
'-' for standard input or output.
==21051== 
==21051== HEAP SUMMARY:
==21051==     in use at exit: 480 bytes in 10 blocks
==21051==   total heap usage: 156 allocs, 146 frees, 77,419 bytes allocated
==21051== 
==21051== LEAK SUMMARY:
==21051==    definitely lost: 0 bytes in 0 blocks
==21051==    indirectly lost: 0 bytes in 0 blocks
==21051==      possibly lost: 0 bytes in 0 blocks
==21051==    still reachable: 480 bytes in 10 blocks
==21051==         suppressed: 0 bytes in 0 blocks
==21051== Rerun with --leak-check=full to see details of leaked memory
==21051== 
==21051== For counts of detected and suppressed errors, rerun with: -v
==21051== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
broucaries
Posts: 467
Joined: 2008-12-21T11:51:10-07:00

Re: convert crashes in memcpy on CentOS 6.6

Post by broucaries »

valgrind /usr/bin/convert -quality 80 -background white /some/path/w/images/c/c4/2014_Public_Creative_Calendar.jpg -thumbnail 89x120! -set comment 'File source: http://example.com/wiki/File:2014_Publi ... lendar.jpg' -depth 8 -sharpen 0x0.4 -rotate -0 /tmp/transform_7e55c77fcada-1.jpg
ufnms
Posts: 4
Joined: 2015-09-16T07:30:40-07:00
Authentication code: 1151

Re: convert crashes in memcpy on CentOS 6.6

Post by ufnms »

With a prior abrt-reported crash instead:

Code: Select all

==21548== Memcheck, a memory error detector
==21548== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==21548== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==21548== Command: /usr/bin/convert -background white /home/ns/public_html.2009.06.14/mediawiki-1.25.1/images/e/e4/Ssrb230a-iwan-3750-1-s1m0p3-n.gif -thumbnail 1254x1199! -set comment File\ source:\ https://[removed].edu/wiki/index.php/File:Ssrb230a-iwan-3750-1-s1m0p3-n.gif -depth 8 -rotate -0 /home/ns/public_html.2009.06.14/mediawiki-1.25.1/images/tmp/transform_6f68afca138b-1.gif
==21548== 
==21548== 
==21548== HEAP SUMMARY:
==21548==     in use at exit: 3,736 bytes in 17 blocks
==21548==   total heap usage: 3,185 allocs, 3,168 frees, 246,606,195 bytes allocated
==21548== 
==21548== LEAK SUMMARY:
==21548==    definitely lost: 0 bytes in 0 blocks
==21548==    indirectly lost: 0 bytes in 0 blocks
==21548==      possibly lost: 912 bytes in 3 blocks
==21548==    still reachable: 2,824 bytes in 14 blocks
==21548==         suppressed: 0 bytes in 0 blocks
==21548== Rerun with --leak-check=full to see details of leaked memory
==21548== 
==21548== For counts of detected and suppressed errors, rerun with: -v
==21548== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
Post Reply