Page 1 of 1

unable to acquire cache view `Success'

Posted: 2008-10-27T16:40:33-07:00
by rmagick
What does this message mean? What might cause it?

Re: unable to acquire cache view `Success'

Posted: 2008-10-27T18:29:41-07:00
by magick
In general one would only get this message if there was a pixel cache view leak or if there was hundreds of simultaneous threads of execution. What version of ImageMagick are you using? Does it happen with ImageMagick 6.4.5-0? Can you post a minimal RMagick script or reproduce it with MagickCore such that we can reproduce the problem?

Re: unable to acquire cache view `Success'

Posted: 2008-10-28T16:33:15-07:00
by rmagick
Below is the simplest RMagick program that reproduces the problem. This program reliably fails for me on the 256th call to CompareImageChannels, after which the 6th call to AcquireCacheView fails. GDB shows this info. cache_view->id is 0.

Code: Select all

123         cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
(gdb) n
124         cache_view->debug=IsEventLogging();
(gdb)
125         cache_view->signature=MagickSignature;
(gdb)
126         if (cache_view->id == 0)
(gdb)
127           ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
(gdb) whe
#0  AcquireCacheView (image=0x80ecec0) at magick/cache-view.c:127
#1  0xb7970b0d in AcquireCacheViewThreadSet (image=0x80ecec0) at magick/cache-view.c:308
#2  0xb79829fd in CompareImageChannels (image=0x80ecec0, reconstruct_image=0x80ecec0, channel=DefaultChannels,
    metric=MeanAbsoluteErrorMetric, distortion=0xbfa4d0e8, exception=0xbfa4d0c8) at magick/compare.c:196
Oh, here's what cache_view is:

Code: Select all

(gdb) p *cache_view
$10 = {id = 0, image = 0x80ecec0, virtual_pixel_method = UndefinedVirtualPixelMethod, debug = MagickFalse, signature = 2880220587}
Here's the RMagick reproduction. It compares logo.miff to itself, then calls DestroyImage on the image that CompareImageChannels returns. (

I could probably code up a C version of this if it would help.

Code: Select all

require 'RMagick'

$stdout.sync = true

logo = Magick::Image.read("logo.miff").first

1000.times do |n|

      cimg, diff = logo.compare_channel(logo, Magick::MeanAbsoluteErrorMetric)
      cimg.destroy!

      printf("Iteration %d (diff=%f)\r", n+1, diff)
      puts(" ") if n+1 == 256
end
Here's the logo.miff image.
http://home.nc.rr.com/foxhunter/logo.miff

Re: unable to acquire cache view `Success'

Posted: 2008-10-28T19:04:59-07:00
by magick
We can reproduce the problem you reported and will have a fix sometime tomorrow. Thanks.