[Magick-bugs] Stack overflow error in convert PDF to jpg using jmagick.dll

Marc Muncke marc.muncke at compax.at
Mon Feb 19 09:50:30 CST 2007


Hello,

What I do is : 
Get all .pdf files in a directory that have not yet been processed (from a
db)
Apply -quantize GRAY with jmagick.dll to it 
Save as Jpg to the same directory

Or 
Upload a file via JSP to tomcat 
Apply -quantize GRAY with jmagick.dll to it 
Save as Jpg to the same directory

My Problem is :

After between 10 to 20 pdf files (sometimes more, sometimes less) I recieve
The following Error  on the tomcat console:

An unrecoverable stack overflow has occurred.
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x100d7f85, pid=2708,
tid=2104
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_05-b05 mixed mode, sharing)
# Problematic frame:
# C  [CORE_RL_magick_.dll+0xd7f85]
#
# An error report file with more information is saved as hs_err_pid2708.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

And tomcat is dead.
I apply the file hs_err_pid2708.log to this mail

When I then run the program again on the file where it failed it runs fine
until after the next 10-20

Versions :

Server : Windows XP or windows 2000 Server
ImageMagick-6.3.2-Q16
apache-tomcat-5.5.12
jdk1.5.0_05
Ghostscript gs8.54


This is the spilt function on the server : 

   public void splitPDF () {
	   try {
		   String filepath1 = new String();
		   String filepath2 = new String();
		   filepath1
=UploadServerConfiguration.getInstance().getArchiveFolder();
		   filepath2
=UploadServerConfiguration.getInstance().getArchiveFolder();
		   String filep1 ="";
		   String filep2="";
		   List scans= <<some db query here>>
 		   Iterator iter = scans.iterator();
		   while (iter.hasNext()) {
			   BScans scan = (BScans) iter.next();
			   if (scan.getPath() != null &&
!scan.getPath().equals("")) {
					filep1 =
filepath1+"/"+scan.getPath()+"/"+scan.getFilename()+"."+scan.getFileending()
;
				}else {
					filep1 =
filepath1+scan.getFilename()+"."+scan.getFileending();
				}
			   if (scan.getPath() != null &&
!scan.getPath().equals("")) {
					filep2 =
filepath2+"/"+scan.getPath()+"/"+scan.getFilename();
				}else {
					// ;
				}
				ImageInfo info = new ImageInfo(filep1);
				MagickImage image = new MagickImage(info);
				MagickImage [] imArray =
image.breakFrames(); 
				QuantizeInfo qi = new QuantizeInfo();
	
qi.setColorspace(ColorspaceType.GRAYColorspace);
				for (int i = 0 ; i < imArray.length ; i++ )
{
					imArray[i].quantizeImage(qi);
	
imArray[i].setFileName(filep2+"-"+i+".jpg");
					imArray[i].writeImage(info);
				}
		   }
	   }catch (Exception e) {
		   e.printStackTrace();
	   }
   }

Or the uploader :



Running convert from the commandline works without any problems

Thank you for your help

M.Muncke



More information about the Magick-bugs mailing list