Persistent Cache doesn't work
Posted: 2017-03-11T23:02:32-07:00
Apology for no reproducer since I'm in a hurry.
I'm trying to use this script http://www.fmwconcepts.com/imagemagick/notch/ working with a fairly large image using mpc files (3304 x 4083).
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114
The operation failed with "unable to extend cache". The following is a debug trace.
The problem here seems to be some logic error in the code. Here is the corresponding strace:
The cache file is opened as read-only and called with pwrite(), which is obviously not ok and this isn't even a problem with memory.
I'm trying to use this script http://www.fmwconcepts.com/imagemagick/notch/ working with a fairly large image using mpc files (3304 x 4083).
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114
The operation failed with "unable to extend cache". The following is a debug trace.
Code: Select all
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Configure convert-im6.q16[26344]: utility.c/ExpandFilenames/940/Configure
Command line: convert {-debug} {All} {-verbose} {-monitor} {./notch_2_26311.mpc[0]} {-ping} {-format} {%w} {info:}
[...]
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Module convert-im6.q16[26344]: module.c/OpenModule/1288/Module
Searching for module "MPC" using filename "mpc.la"
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Module convert-im6.q16[26344]: module.c/GetMagickModulePath/558/Module
Searching for coder module file "mpc.la" ...
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Module convert-im6.q16[26344]: module.c/OpenModule/1297/Module
Opening module at path "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7//modules-Q16/coders/mpc.la"
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Module convert-im6.q16[26344]: module.c/OpenModule/1324/Module
Method "RegisterMPCImage" in module "MPC" at address 0x7f980b6287a0
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Module convert-im6.q16[26344]: module.c/OpenModule/1338/Module
Method "UnregisterMPCImage" in module "MPC" at address 0x7f980b628840
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Policy convert-im6.q16[26344]: policy.c/IsRightsAuthorized/580/Policy
Domain: Path; rights=Read; pattern="./notch_2_26311.mpc" ...
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Blob convert-im6.q16[26344]: blob.c/OpenBlob/2593/Blob
read 3 magic header bytes
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Cache convert-im6.q16[26344]: cache.c/DestroyPixelCache/1123/Cache
destroy
[...]
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Policy convert-im6.q16[26344]: policy.c/IsRightsAuthorized/580/Policy
Domain: Coder; rights=Read; pattern="MPC" ...
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Policy convert-im6.q16[26344]: policy.c/IsRightsAuthorized/580/Policy
Domain: Path; rights=Read; pattern="./notch_2_26311.mpc" ...
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Blob convert-im6.q16[26344]: blob.c/OpenBlob/2593/Blob
read 3 magic header bytes
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Width: 4.08KB/4.08KB/16KB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Height: 4.08KB/4.08KB/16KB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Cache convert-im6.q16[26344]: cache.c/PersistPixelCache/4122/Cache
attach persistent cache
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Width: 4.08KB/4.08KB/16KB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Height: 4.08KB/4.08KB/16KB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Area: 133.4MB/133.4MB/128MB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Disk: 133.4MB/127.3MiB/1GiB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
File: 1B/1B/768B
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Cache convert-im6.q16[26344]: cache.c/SetPixelCacheExtent/3737/Cache
extend ./notch_2_26311.mpc[0] (./notch_2_26311.cache[4], disk, 133.4MB)
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Map: 133.4MB/127.3MiB/512MiB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/RelinquishMagickResource/1013/Resource
File: 1B/0B/768B
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Cache convert-im6.q16[26344]: cache.c/OpenPixelCache/4022/Cache
open ./notch_2_26311.mpc[0] (./notch_2_26311.cache[-1], Map, 4084x4084 127.3MiB)
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Width: 4.08KB/4.08KB/16KB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Height: 4.08KB/4.08KB/16KB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Cache convert-im6.q16[26344]: cache.c/PersistPixelCache/4122/Cache
attach persistent cache
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Width: 4.08KB/4.08KB/16KB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Height: 4.08KB/4.08KB/16KB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Area: 133.4MB/133.4MB/128MB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
Disk: 133.4MB/254.5MiB/1GiB
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Resource convert-im6.q16[26344]: resource.c/AcquireMagickResource/318/Resource
File: 1B/1B/768B
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Cache convert-im6.q16[26344]: cache.c/SetPixelCacheExtent/3737/Cache
extend ./notch_2_26311.mpc[1] (./notch_2_26311.cache[4], disk, 266.9MB)
[...]
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Exception convert-im6.q16[26344]: cache.c/OpenPixelCache/3966/Exception
unable to extend cache `./notch_2_26311.mpc': Bad file descriptor
2017-03-11T23:51:22-05:00 0:00.000 0.000u 6.9.7 Exception convert-im6.q16[26344]: mpc.c/ReadMPCImage/944/Exception
unable to persist pixel cache `./notch_2_26311.mpc'
Code: Select all
25778 open("./notch_2_25746.cache", O_RDONLY) = 4
[...]
25778 lseek(4, 0, SEEK_END) = 133432448
25778 pwrite64(4, "\0", 1, 266867839) = -1 EBADF (Bad file descriptor)