Page 1 of 1

Temp file leak in 6.4.5-8

Posted: 2008-11-19T17:03:34-07:00
by rmagick
I hope this is enough to go by. If not let me know and I'll try to make a simple reproduction.

Code: Select all

$ convert -version
Version: ImageMagick 6.4.5 2008-11-18 Q16 http://www.imagemagick.org
I am observing a temporary file leak when the memory resource is severely cramped such that OpenCache calls AcquireUniqueFileResource to create a temp file. The file name that is created is something like magick-XXYiVkz9. However, before DestroyCacheInfo calls remove() to delete the file, it calls AppendImageFormat to append ".cache" to filename, so that it tries to delete magick-XXYiVkz9.cache.

Here's the traceback for the call to AcquireUniqueFileResource()

Code: Select all

#0  AcquireUniqueFileResource (path=0x8377630 "/home/tim/tmp/magick-XXYiVkz9") at magick/resource.c:413
#1  0xb7908cd6 in OpenDiskCache (cache_info=0x83765e8, mode=IOMode) at magick/cache.c:1131
#2  0xb790f46a in OpenCache (image=0x8373380, mode=IOMode, exception=0x8376548) at magick/cache.c:3824
#3  0xb79120a5 in SyncCache (image=0x8373380, exception=0x8376548) at magick/cache.c:4953
#4  0xb79117c2 in SyncImagePixelCache (image=0x8373380, exception=0x8376548) at magick/cache.c:4675
#5  0xb7911366 in SetCacheNexus (image=0x8373380, x=0, y=0, columns=0, rows=0, nexus=0, exception=0x8376548) at magick/cache.c:4564
#6  0xb7911d89 in SetPixelCache (image=0x8373380, x=0, y=0, columns=0, rows=0, exception=0x8376548) at magick/cache.c:4834
#7  0xb79104ba in QueueAuthenticPixels (image=0x8373380, x=0, y=0, columns=0, rows=0, exception=0x8376548) at magick/cache.c:4124
#8  0xb79c4b38 in SetImageExtent (image=0x8373380, columns=20, rows=20) at magick/image.c:3458
Here's the traceback for the call to remove()

Code: Select all

Breakpoint 2, 0xb7cd3a76 in remove () from /lib/tls/i686/cmov/libc.so.6
(gdb) up
#1  0xb7a1820d in RelinquishUniqueFileResource (path=0x8377630 "/home/tim/tmp/magick-XXYiVkz9") at magick/resource.c:906
906       (void) remove(cache_path);
(gdb) p (char *)cache_path
$10 = 0xbfa4c6d0 "/home/tim/tmp/magick-XXYiVkz9.cache"
(gdb) whe
#0  0xb7cd3a76 in remove () from /lib/tls/i686/cmov/libc.so.6
#1  0xb7a1820d in RelinquishUniqueFileResource (path=0x8377630 "/home/tim/tmp/magick-XXYiVkz9") at magick/resource.c:906
#2  0xb790b478 in DestroyCacheInfo (cache=0x83765e8) at magick/cache.c:1933
#3  0xb790bc6e in DestroyPixelCache (image=0x8373380) at magick/cache.c:2128
#4  0xb790bb83 in DestroyImagePixels (image=0x8373380) at magick/cache.c:2095
#5  0xb79c1321 in DestroyImage (image=0x8373380) at magick/image.c:1696

Re: Temp file leak in 6.4.5-8

Posted: 2008-11-19T19:39:21-07:00
by magick
We can reproduce the problem you posted and will have a fix within a day or two. Thanks.