some converts never finish

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Bruki
Posts: 4
Joined: 2011-12-06T13:40:31-07:00
Authentication code: 8675308

some converts never finish

Post by Bruki »

I'm using the latest ImageMagick from MacPorts (ImageMagick 6.7.1-0 2011-07-16 Q16). I use the convert command to make thumbnails. All is fine, except this:

Maybe every 1000th or even 100th convert command never finish. The process sticks with a lot of cpu power and will never finish. The convert command usually takes only few seconds.

Till now I solved the problem with watching the pid of the convert command and if the convert command stays with the same pid over 5 min I kill the pid and I do the convert job again with the same parameters - without problems.

I can see this behavior on 3 different installations with Snow Leopard, it never happened to me with Tiger.

Does any body have the same problem? Can any body give some help?

Thanks a lot!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: some converts never finish

Post by magick »

Some of your images may be aberrant. See if you can isolate the particular image the command is failing on. You'll then need to debug. Add -debug cache to your command line and see where ImageMagick is hanging. For more detailed debugging, add -debug all or -debug all,trace to your command line.
Bruki
Posts: 4
Joined: 2011-12-06T13:40:31-07:00
Authentication code: 8675308

Re: some converts never finish

Post by Bruki »

Thanks for your fast replay!

My problem is that it does not depend on the image I convert. If I kill the process that hangs and repeat the same convert job with same parameters and same image files even with the same destination file it will not hang again. So It's not possible to isolate a single file.

What I can try to do is to write a script using the convert command as simple as possible to make my problem repeatable.
Bruki
Posts: 4
Joined: 2011-12-06T13:40:31-07:00
Authentication code: 8675308

Re: some converts never finish

Post by Bruki »

Ok, this small script:

Code: Select all

#!/bin/bash

i=0

while true
do
	let "i=i+1"
	echo $i > log.txt
	convert -strip -thumbnail x450 -compress JPEG -colorspace RGB -append ./line1.tiff ./line2.tiff ./line3.tiff ./3160.med.jpg
done
combines always the SAME three images to a destination image. i counts how many times the convert command was executed and write it's value to the log file. After more or less 500 iterations the convert command hangs, without giving any error message to the stdout nor to the console. The convert command hangs with constant 75% cpu power.

Here are the three images:
http://92u.ch/temp_im/line1.tiff
http://92u.ch/temp_im/line2.tiff
http://92u.ch/temp_im/line3.tiff

System:
Intel Core Duo MacMini / Snow Leopard 10.6.8 / Image Magick 6.7.3-1 2011-11-22 Q16
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: some converts never finish

Post by magick »

We're running Mac Lion and ImageMagick 6.7.3-10 on our PowerBook. We looped your script over 10,000 iterations and each iteration ran to completion without delay or complaint.

Try adding
  • export MAGICK_THREAD_LIMIT=1
to your script. Does that help?
Bruki
Posts: 4
Joined: 2011-12-06T13:40:31-07:00
Authentication code: 8675308

Re: some converts never finish

Post by Bruki »

It seems this helps!! At least I could run the script more than 20'000 times without making convert to hang. Great, thanks you a lot!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: some converts never finish

Post by magick »

It looks like there is a bug in libgomp under Snow Leopard. The libgomp library is utilized by ImageMagick for threading. A MAGICK_THREAD_LIMITof 1 stops threading and avoid a deadlock.
Post Reply