Page 1 of 1
Display pixel cache file
Posted: 2011-05-31T04:16:38-07:00
by mherrmann
Hello everyone,
we are working with a large legacy web application that uses JMagick and ImageMagick 6.0.7 Q16 in several places. We are having the problem that many temporary "magic-XX..." files accumulate over time. This does not happen steadily but stochastically, sometimes more, sometimes less. Unfortunately, since the application is large, we don't know which invocation(s) of J-/ImageMagick leave behind these files. If we knew which images were contained in the "magic-XX..." cache files, this would help us to find out which invocation of J-/ImageMagick is causing the problem. Is there a way to somehow display the contents of such an "magic-XX..." temporary cache file on the screen?
Thank you very much!
Best,
Michael
Re: Display pixel cache file
Posted: 2011-05-31T20:15:25-07:00
by anthony
mherrmann wrote:Hello everyone,
we are working with a large legacy web application that uses JMagick and ImageMagick 6.0.7 Q16 in several places. We are having the problem that many temporary "magic-XX..." files accumulate over time. This does not happen steadily but stochastically, sometimes more, sometimes less. Unfortunately, since the application is large, we don't know which invocation(s) of J-/ImageMagick leave behind these files. If we knew which images were contained in the "magic-XX..." cache files, this would help us to find out which invocation of J-/ImageMagick is causing the problem. Is there a way to somehow display the contents of such an "magic-XX..." temporary cache file on the screen?
Thank you very much!
Best,
Michael
First I knwo little about these caches other than that are memory mapped files, used by Imagemagick when it has run out of real memory (either for real, or by resource limits). they may also be temporary images needed for delegate processing. Generally they are only left behind if IM was 'rudely' terminated without giving it a chance to clean up.
You can specify a directory for individual IM commands to use using the environment variable MAGICK_TEMPORARY_PATH. If you do this you could 'auto-cleanup' a problem like this by creating a sub-directory in temp, setting that variable, then latter just deleting that sub-directory when all is done!
As to what image created what cache, best suggestion I can offer is to look at the "strings" command output on these files. This UNIX command looks for continuous lengths of ASCII strings in binary data, and can be used to see 'labels' and other ASCII information in the file.
If you add label, comment, caption, and other stings to the image you should then be able to identify which cache came from which image, but it may be multiple images in a single cache (I am don't know).
Regardless please get back to use with what you did, what you found, what worked, what did not. Many other people would probably in interested in your findings. Including me
Re: Display pixel cache file
Posted: 2011-06-03T00:28:14-07:00
by mherrmann
Hi and thank you for your reply,
unfortunately, I don't even know where the images are coming from, so can't add any strings to them. The "strings" command on the cache files I have did not yield anything. Setting MAGICK_TEMPORARY_PATH and cleaning up would be an option. However, I don't even know when the image operations that leave the cache files behind are taking place (we have so many different operations) that the only solution of cleaning up would be a batch job that runs every x minutes/hours/days. Before attempting to do that, I would rather spend some more time finding and fixing the root cause of the problem in our application (i.e. when ImageMagick does not terminate properly).
Does maybe anybody else have an idea how I could see the contents of the cache files (maybe with some luck)?
Thanks,
Michael
Re: Display pixel cache file
Posted: 2011-06-03T18:12:27-07:00
by anthony
WHEN is easy. Like at the file time stamps on the cache images!
WHAT generates a temporary file (in this case what called IM). Is a lot harder and you will just have to start with a list of posible causes and track them down one by one. If it is a web server. Look at the web browser log for the time period, that should give you a good start. Similarly for cron jobs.