Locking error prevents program termination
Posted: 2014-03-26T03:54:31-07:00
On certain input images and command line options convert does not terminate due to infinitely waiting for a lock. The input image is from a customer, so it's confidential and I can't provide it for debugging. I try to find a public image which also triggers this bug.
Version used is from Debian experimental, but I could reproduce the problem with a vanilla 6.8.8-8 with and without OpenMP. The bug does not show in 6.8.4-7.
I tried to reduce the options involved, these seem to be the minimum set:
looking through the sources, it seems to be this global pointer which is tried to aquire to lock on recursively:
Code: Select all
$ convert -version
Version: ImageMagick 6.8.8-2 Q16 x86_64 2014-01-30 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
Code: Select all
$ identify d0d0559340944f60e6ec4f461b3da3601a4ae493
d0d0559340944f60e6ec4f461b3da3601a4ae493 TIFF 7087x9449 7087x9449+0+0 8-bit CMYK 430.1MB 2.200u 0:02.210
identify: Unknown field with tag 34152 (0x8568) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/847.
Code: Select all
$ convert \
d0d0559340944f60e6ec4f461b3da3601a4ae493 \
-limit map 512MB -limit memory 256 -limit thread 1 \
-profile sRGB_IEC61966-2-1_black_scaled.icc \
out.png
Code: Select all
(gdb) bt
#0 __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1 0x00007f2f60be4467 in _L_lock_913 () from /lib/x86_64-linux-gnu/libpthread.so.0
#2 0x00007f2f60be4290 in __GI___pthread_mutex_lock (mutex=0x13f2140) at ../nptl/pthread_mutex_lock.c:79
#3 0x00007f2f6129c19e in LockSemaphoreInfo (semaphore_info=0x13f2140) at ../../magick/semaphore.c:346
#4 0x00007f2f612a6dee in GetValueFromSplayTree (splay_tree=0x13f29d0, key=key@entry=0x7f2f613242af)
at ../../magick/splay-tree.c:893
#5 0x00007f2f6128cea1 in GetImageRegistry (type=type@entry=StringRegistryType,
key=key@entry=0x7f2f613242af "shred-passes", exception=exception@entry=0x1381190) at ../../magick/registry.c:201
#6 0x00007f2f612c8f05 in ShredFile (path=path@entry=0x7fff94b8a390 "/tmp/magick-726923LSxE7jG6CL.cache")
at ../../magick/utility.c:1815
#7 0x00007f2f61298472 in RelinquishUniqueFileResource (path=path@entry=0x13cc218 "/tmp/magick-726923LSxE7jG6CL")
at ../../magick/resource.c:905
#8 0x00007f2f6116f6fc in RelinquishPixelCachePixels (cache_info=0x13cb170) at ../../magick/cache.c:904
#9 DestroyPixelCache (cache=0x13cb170) at ../../magick/cache.c:961
#10 0x00007f2f6116f7e5 in DestroyImagePixels (image=0x13d5450) at ../../magick/cache.c:841
#11 0x00007f2f612282ff in DestroyImage (image=0x13d5450) at ../../magick/image.c:1043
#12 0x00007f2f61233b9a in DeleteImageFromList (images=images@entry=0x7fff94b8c418) at ../../magick/list.c:298
#13 0x00007f2f61233f38 in DestroyImageList (images=0x0) at ../../magick/list.c:451
#14 0x00007f2f6128cded in DestroyRegistryNode (registry_info=0x1399620) at ../../magick/registry.c:445
#15 0x00007f2f612a6a25 in DestroySplayTree (splay_tree=0x13f29d0) at ../../magick/splay-tree.c:694
#16 0x00007f2f6128d093 in RegistryComponentTerminus () at ../../magick/registry.c:332
#17 0x00007f2f6123a43a in MagickCoreTerminus () at ../../magick/magick.c:1407
#18 0x000000000040089f in ConvertMain (argv=<optimized out>, argc=14) at ../../utilities/convert.c:85
#19 main (argc=14, argv=<optimized out>) at ../../utilities/convert.c:92
Code: Select all
magick/registry.c:
static SplayTreeInfo
*registry = (SplayTreeInfo *) NULL;