Infinite Loop with Ghostscript Caused by "Identify"

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
Print4Alan

Infinite Loop with Ghostscript Caused by "Identify"

Post by Print4Alan »

We get tons of EPS uploads and periodically there are a few that cause "gs" to go into an infinite loop.

I isolated a file that will cause this...
http://208.109.225.220/BadFile.eps

Run "identify BadFile.eps" and ghostscript will take up 100% of the CPU for many days. Kill the Process ID and a new one will start up immediately after, which also runs forever.

If I type in "gs BadFile.eps" there will be messages about missing fonts. I could prevent infinite loops by checking the output of "gs" before running the file in ImageMagick's "identify". But maybe this will help solve other bugs?

I am on Linux x64
GPL Ghostscript 8.60
ImageMagick 6.3.6 11/02/07 Q16
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Infinite Loop with Ghostscript Caused by "Identify"

Post by magick »

Curious. Your EPS image converted fine for us with Ghoscript 8.60 and ImageMagick 6.3.6-5. Not sure why it failed for you.
Print4Alan

Re: Infinite Loop with Ghostscript Caused by "Identify"

Post by Print4Alan »

I tried recompiling Ghostscript and I also installed IM 6.3.6-6 (which it looks like you released today). I am still getting the same problem. "identify" will just hang with a blinky cursor while "gs" is spinning at 100%. If I kill the "gs" process ID another one pops up at 100% almost immediately. Killing both of them causes "identify" to complete. If I just CTRL-C on the "identify" shell window then it kills the "gs" process and the second one never starts.

We get lots of EPS uploads and it is rare that I find ones that do this. But if I don't check the server for a week or two, I may have many "gs" processes making the server run sluggish.

I am wondering if running on Linux x64 has something to do with it? Although ImageMagick and Ghostscript compiled without any problems, there were a number of other (unrelated) bugs I have ran into after our recent server migration. Maybe that is the difference between our 2 setups?

If I open the BadFile.eps in Illustrator CS2 I do not get any errors or warnings. If I resave it as a "CS2 EPS" I can run "identify" on the copy no problem.

Can you tell me if you get an error when entering the command...
>gs BadFile.eps

Ghostscript returns the following error for me ...
-----------------------------------------
GPL Ghostscript 8.60 (2007-08-01)
Copyright (C) 2007 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Can't find (or can't open) font file n019003l.pfb.
Can't find (or can't open) font file Resource/Font/NimbusSanL-Regu.
Can't find (or can't open) font file NimbusSanL-Regu.
Can't find (or can't open) font file Resource/Font/NimbusSanL-Regu.
Can't find (or can't open) font file NimbusSanL-Regu.
Querying operating system for font files...
Can't find (or can't open) font file n019003l.pfb.
Can't find (or can't open) font file Resource/Font/NimbusSanL-Regu.
Can't find (or can't open) font file NimbusSanL-Regu.
Didn't find this font on the system!
Substituting font Courier for NimbusSanL-Regu.
Can't find (or can't open) font file n022003l.pfb.
Loading NimbusMonL-Regu font from /usr/share/fonts/default/Type1/n022003l.pfb... 3766800 1932842 2268944 550310 2 done.
Can't find (or can't open) font file s050000l.pfb.
Loading StandardSymL font from /usr/share/fonts/default/Type1/s050000l.pfb... 3746616 1961448 3326944 1117164 2 done.
%%BoundingBox: 23 26 323 195
%%HiResBoundingBox: 23.111999 26.795038 322.340967 194.579994
>>showpage, press <return> to continue<<
---------------------------------------------------------


I was hoping you may get an idea from the fact that there are always 2 "gs" processes that run away. If you still have no clue what this could be.... can you provide me with some guidance how to setup a debugging scenario and any tools that you use. Also what source files I should begin looking in?
Print4Alan

Re: Infinite Loop with Ghostscript Caused by "Identify"

Post by Print4Alan »

I found the "gs" command within the delegates.xml and was able to run the command manually. By turning the "quite" switch off I could see ghostscript spitting out the same error message repeatedly. The -dPARANOIDSAFER was causing font substitution to fail without exiting. I submitted Bug #689550 with ghostscript.
Post Reply