Page 1 of 1

Catastrophic Failure

Posted: 2010-12-03T09:57:21-07:00
by bachuba
I've written a Delphi utility that uses the version 6.6.6 ImageMagickObject.dll to perform a bunch of Convert calls on each page of a multi-page tiff (resizing, cropping, etc.). Everything has been working great until recently when I've tried it on tiffs with greater numbers of pages. Running on a tiff with 20 pages, about 10 MB total in size, causes the DLL to fall over reporting "Catastrophic Failure" sometimes. The page being processed when the error occurs varies from attempt to attempt, but the specific Convert call seems to be consistent. I'm hoping someone will understand the stack trace from the DLL or the debug information from ImageMagick better than I. Thanks in advance for any help.

Convert Call:

Code: Select all

Convert -debug All ( -size 347x223 xc:black ) Scan0_out_Page_7_1_DSK_2.tif -composite -depth 1 Scan0_out_Page_7_1_DSK_3.tif
Stack Trace from AQTime:

Code: Select all

First chance exception 0xC0000005 ACCESS_VIOLATION occurred at 0x78AA1FB4, read of address 0x0216E000 at 0x78AA1FB4 (in C:\Program Files\ImageMagick-6.6.6-Q16\msvcr100.dll)
0x78AA1FB4 memcpy + 0x134 in msvcr100.dll
0x01D4AF5F CloneString + 0x16F in CORE_RL_magick_.dll
0x02000C10 MogrifyImageInfo + 0x1340 in CORE_RL_wand_.dll
0x01D0785D ParseMagickOption + 0x10D in CORE_RL_magick_.dll
0x01D079DA ParseMagickOption + 0x28A in CORE_RL_magick_.dll
0x01CF613B LogMagickEventList + 0xAB in CORE_RL_magick_.dll
0x01CF613B LogMagickEventList + 0xAB in CORE_RL_magick_.dll
0x7C91084C wcsncpy + 0x2CD in ntdll.dll
0x7C910981 wcsncpy + 0x402 in ntdll.dll
0x7C91005D RtlFreeHeap + 0x130 in ntdll.dll
ImageMagick Debug information surrounding issue (Note that Scan0_out_Page_7_1_DSK_2.tif is just a single page tiff that has been extracted from the multi-page tiff at this point):

Code: Select all

2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1542/Resource
  arg: -convert
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::Perform/682/Resource
  ImageMagickObject - Perform enter
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1542/Resource
  arg: -debug
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1572/Resource
  arg: All
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1572/Resource
  arg: (
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1542/Resource
  arg: -size
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1572/Resource
  arg: 347x223
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1572/Resource
  arg: xc:black
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1572/Resource
  arg: )
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1572/Resource
  arg: Scan0_out_Page_7_1_DSK_2.tif
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1542/Resource
  arg: -composite
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1542/Resource
  arg: -depth
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1572/Resource
  arg: 1
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::AddArgs/1572/Resource
  arg: Scan0_out_Page_7_1_DSK_3.tif
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::Perform/1036/Resource
  ImageMagickObject - Perform before execute
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Configure Magick[2896]: utility.c/ExpandFilenames/906/Configure
  Command line: -convert {-debug} {All} {(} {-size} {347x223} {xc:black} {)} {Scan0_out_Page_7_1_DSK_2.tif} {-composite} {-depth} {1} {Scan0_out_Page_7_1_DSK_3.tif}
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Policy Magick[2896]: policy.c/IsRightsAuthorized/485/Policy
  Domain: Coder; rights=Read; pattern="XC" ...
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: resource.c/AcquireMagickResource/262/Resource
  Area: 619KB/619KB/3.4871GB
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Resource Magick[2896]: resource.c/AcquireMagickResource/262/Resource
  Memory: 619KB/605KiB/12.99GiB
2010-12-03T11:24:31-05:00 0:17.424 17.703u 6.6.6 Cache Magick[2896]: cache.c/OpenPixelCache/4056/Cache
  open black[0] (heap memory, 347x223 605KiBB)
2010-12-03T11:24:31-05:00 0:17.471 17.750u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/MagickImage::FinalRelease/332/Resource
  FinalRelease
ERROR: Catastrophic failure
2010-12-03T11:24:31-05:00 0:17.487 17.766u 6.6.6 Resource Magick[2896]: ImageMagickObject.cpp/CModuelOverrideClass::DllMain/92/Resource
  DLL Detach -  path: C:\Program Files\ImageMagick-6.6.6-Q16\ImageMagickObject.dll

Re: Catastrophic Failure

Posted: 2010-12-03T10:06:58-07:00
by magick
Add '-limit area 0' to your convert command line. Does that fix the problem?

Re: Catastrophic Failure

Posted: 2010-12-03T10:19:00-07:00
by bachuba
Thanks for the reply. No, I added that option and it failed in the same spot.

Re: Catastrophic Failure

Posted: 2010-12-06T07:02:08-07:00
by bachuba
Any other ideas on this? Is there any other information I can gather that might be useful?