unable to acquire cache view `Success'

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

unable to acquire cache view `Success'

Post by rmagick »

What does this message mean? What might cause it?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: unable to acquire cache view `Success'

Post 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?
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: unable to acquire cache view `Success'

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: unable to acquire cache view `Success'

Post by magick »

We can reproduce the problem you reported and will have a fix sometime tomorrow. Thanks.
Post Reply