MAGICK_DEBUG gives garbled output and crashes eventually

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.
Post Reply
jn0101
Posts: 40
Joined: 2007-06-16T01:36:07-07:00

MAGICK_DEBUG gives garbled output and crashes eventually

Post by jn0101 »

I have set MAGICK_DEBUG=Resource

After this the messages of IM appears garbled in the beginning.

Code: Select all

C:\Jacob>convert x.jpg -resample 1000x1000 y.jpg
x☺╟ 6.3.6 Resource convert[4004]: resource.c/AcquireMagickResource/216/Resource
  Area: 1.0756mb/1.0756mb/2.98438gb
x☺╟ 6.3.6 Resource convert[4004]: resource.c/AcquireMagickResource/216/Resource
  Memory: 1.0756mb/1.0756mb/2.23828gb
x☺╟ 6.3.6 Resource convert[4004]: resource.c/AcquireMagickResource/216/Resource
  Area: 207.484mb/207.484mb/2.98438gb
x☺╟ 6.3.6 Resource convert[4004]: resource.c/AcquireMagickResource/216/Resource
  Memory: 207.484mb/208.559mb/2.23828gb
x☺╟ 6.3.6 Resource convert[4004]: resource.c/AcquireMagickResource/216/Resource
  Area: 14.9388mb/14.9388mb/2.98438gb
x☺╟ 6.3.6 Resource convert[4004]: resource.c/AcquireMagickResource/216/Resource
  Memory: 14.9388mb/223.498mb/2.23828gb
The above prints the four letters 'x☺╟ ' in front of all the messages.


In a longer program that invokes many operations this garbling gets longer and longer:

Code: Select all

°¢8D(q►;_§δ↓▌? 6.3.6 Resource ImageMagick[4064]: resource.c/AcquireMagickResource/216/Resource
  Area: 174.387mb/174.387mb/2.98438gb 6.3.6 Resource ImageMagick[4064]: resource.c/AcquireMagickResource/216/Resource
  Memory: 174.387mb/348.774mb/2.23828gb 6.3.6 Resource ImageMagick[4064]: resource.c/RelinquishMagickResource/824/Resource
  Memory: 174.387mb/174.387mb/2.23828gb 74.078u 6.3.6 Resource ImageMagick[4064]: resource.c/AcquireMagickResource/216/Resource
  Disk: 174.387mb/174.387mb/4eb ImageMagick[4064]: resource.c/AcquireUniqueFileResource/418/Resource
  C:/DOCUME~1/Admin/LOCALS~1/Temp/magick-wFanSi0N ImageMagick[4064]: resource.c/RelinquishUniqueFileResource/857/Resource
  C:/DOCUME~1/Admin/LOCALS~1/Temp/magick-wFanSi0N ImageMagick[4064]: resource.c/AcquireUniqueFileResource/418/Resource
  C:/DOCUME~1/Admin/LOCALS~1/Temp/magick-fA7t3rBx 1:18 74.094u 6.3.6 Resource ImageMagick[4064]: resource.c/AcquireMagickResource/216/Resource
  File: 0b/0b/1.5kb


This has been seen using IM 636 Q8 on Linux and Windows.

On Linux the program eventually crashes when MAGICK_DEBUG=Resource is set, with the message:
'*** glibc detected *** malloc(): memory corruption ***
A similar message has not (yet) been seen on Windows.

To me it seems that setting MAGICK_DEBUG=Resource will corrupt memory.
jn0101
Posts: 40
Joined: 2007-06-16T01:36:07-07:00

Re: MAGICK_DEBUG gives garbled output and crashes eventually

Post by jn0101 »

Here are som backtraces on Linux:

Code: Select all

*** glibc detected *** /home/local/jdk1.6.0/bin/java: malloc(): memory corruption: 0x7b508208 ***
======= Backtrace: =========
/lib/i686/libc.so.6[0xb7e73db6]
/lib/i686/libc.so.6(__libc_malloc+0x97)[0xb7e757b7]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(AcquireMagickMemory+0x21)[0x7de170a1]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ResizeMagickMemory+0x5c)[0x7de1711c]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ResizeQuantumMemory+0x5f)[0x7de1718f]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(LogMagickEventList+0x211)[0x7de12a11]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(LogMagickEvent+0x43)[0x7de13433]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(AcquireMagickResource+0xeb)[0x7de57dfb]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10[0x7dd751e0]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10[0x7dd75eae]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(SetCacheNexus+0x240)[0x7dd76fc0]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10[0x7dd77201]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(SetImagePixels+0x83)[0x7dd6f073]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(SetImageExtent+0x53)[0x7de026d3]
/home/j/Caramba/magick-beta/ImageMagick/lib/ImageMagick-6.3.6/modules-Q8/coders/jpeg.so[0x7e1b2834]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ReadImage+0x255)[0x7dd95625]

Code: Select all

*** glibc detected *** /home/local/jdk1.6.0/bin/java: free(): invalid next size (normal): 0x7e062a20 ***
======= Backtrace: =========
/lib/i686/libc.so.6[0xb7e364e6]
/lib/i686/libc.so.6(cfree+0x90)[0xb7e3a010]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(RelinquishMagickMemory+0x21)[0x7de16fa1]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(LogMagickEventList+0x387)[0x7de12b87]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(LogMagickEvent+0x43)[0x7de13433]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(AcquireMagickResource+0xeb)[0x7de57dfb]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10[0x7dd751e0]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10[0x7dd75eae]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(SetCacheNexus+0x240)[0x7dd76fc0]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(GetCacheNexus+0x71)[0x7dd77281]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10[0x7dd77451]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(GetImagePixels+0x83)[0x7dd6fde3]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ProfileImage+0x3fe)[0x7de2fdbe]

Code: Select all

*** glibc detected *** /home/local/jdk1.6.0/bin/java: free(): invalid next size (normal): 0x0851e3d8 ***
======= Backtrace: =========
/lib/i686/libc.so.6[0xb7e9a4e6]
/lib/i686/libc.so.6[0xb7e9c0f2]
/lib/i686/libc.so.6(realloc+0x10d)[0xb7e9e27d]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ResizeMagickMemory+0x34)[0x7de170f4]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ResizeQuantumMemory+0x5f)[0x7de1718f]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ConcatenateString+0x8b)[0x7de6d99b]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ParseCharacterContent+0x7f)[0x7de95a8f]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(NewXMLTree+0x7f4)[0x7de973e4]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10[0x7de10b1c]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(GetLocaleInfo_+0x20c)[0x7de1105c]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(GetLocaleMessage+0x85)[0x7de111f5]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(GetLocaleExceptionMessage+0x6d)[0x7ddeb0bd]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ThrowMagickExceptionList+0x4a)[0x7ddeb99a]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(ThrowMagickException+0x51)[0x7ddebb31]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(NewXMLTree+0x190f)[0x7de984ff]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(GetImageProperty+0xb21)[0x7de2c2b1]
/home/j/Caramba/magick-beta/ImageMagick/lib/libMagick.so.10(SetImageProfile+0xe2)[0x7de2f392]

And some IM output on Linux:

Code: Select all

� 6.3.6 Resource CIS2koersel[22125]: resource.c/unknown/216/Resource
  Area: 25.7812kb/25.7812kb/3.96094gb
� 6.3.6 Resource CIS2koersel[22125]: resource.c/unknown/216/Resource
  Memory: 25.7812kb/25.7812kb/2.9707gb

Code: Select all

�������%9�%9 134.161u 6.3.6 Resource CIS2koersel[22125]: resource.c/unknown/824/Resource
  Memory: 25.7812kb/0b/2.9707gb 6.3.6 Resource CIS2koersel[22125]: resource.c/unknown/216/Resource
  Area: 25.7812kb/25.7812kb/3.96094gb
���:�t��t� 6.3.6 Resource CIS2koersel[22125]: resource.c/unknown/216/Resource
  Memory: 25.7812kb/51.5625kb/2.9707gb 6.3.6 Resource CIS2koersel[22125]: resource.c/unknown/216/Resource
  Memory: 25.7812kb/51.5625kb/2.9707gb
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MAGICK_DEBUG gives garbled output and crashes eventually

Post by magick »

The problem you reported was a transient bug and is fixed in the latest ImageMagick release, 6.3.7-2.
Post Reply