Free Support Forum - groupdocs.com

Is Multi-threading supported?


#1

Hi there,
i am evaluating groupDocs.conversion version 19.6.2
using amazon Corretto open Jdk 1.8 on windows 7 machine 8gb ram
with -Xmx3072m jvm heap space allocated.
while converting Ms office document to jpg format in single threaded mode it works fine
but when i run it with 10 threads using java executor service i am getting following error

com.groupdocs.conversion.domain.savers.words.WordsToImageSaver.save(Unknown Source)
com.groupdocs.conversion.domain.documents.WordsDocument.save(Unknown Source)
com.groupdocs.conversion.operations.f.aK(Unknown Source)
com.groupdocs.conversion.operations.E.execute(Unknown Source)
com.groupdocs.conversion.converter.image.ImageConverter.convert(Unknown Source)
com.groupdocs.conversion.converter.image.ImageConverter.convert(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.aJ(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)
com.poc.digo.tools.GroupDocsConvertor.convertToPdfAsFilePath(GroupDocsConvertor.java:95)
com.poc.digo.tools.GroupDocsConvertor.Convert(GroupDocsConvertor.java:56)
com.poc.digo.main.Launcher.lambda$2(Launcher.java:96)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748) —> class com.groupdocs.conversion.exception.GroupDocsException: com.groupdocs.conversion.internal.c.a.w.internal.uN: Could not create the bitmap with the specified parameters: java.lang.OutOfMemoryError: Java heap space —> com.groupdocs.conversion.internal.c.a.w.internal.uN: Could not create the bitmap with the specified parameters: java.lang.OutOfMemoryError: Java heap space

com.groupdocs.conversion.domain.documents.WordsDocument.a(Unknown Source)
com.groupdocs.conversion.domain.DocumentBase.load(Unknown Source)
com.groupdocs.conversion.operations.r.aT(Unknown Source)
com.groupdocs.conversion.operations.r.c(Unknown Source)
com.groupdocs.conversion.operations.r$3.invoke(Unknown Source)
com.groupdocs.conversion.operations.r.aZ(Unknown Source)
com.groupdocs.conversion.operations.r.execute(Unknown Source)
com.groupdocs.conversion.converter.image.ImageConverter.convert(Unknown Source)
com.groupdocs.conversion.converter.image.ImageConverter.convert(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.aJ(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)
com.poc.digo.tools.GroupDocsConvertor.convertToPdfAsFilePath(GroupDocsConvertor.java:95)
com.poc.digo.tools.GroupDocsConvertor.Convert(GroupDocsConvertor.java:56)
com.poc.digo.main.Launcher.lambda$2(Launcher.java:96)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
— End of inner exception stack trace —

can you please help me to sort out this
i am using following code block

	  conversionConfig = new ConversionConfig();
		conversionConfig.setStoragePath(request.getInputDir());
		conversionConfig.setOutputPath(request.getOutputDir());
		conversionConfig.setUseCache(false);
		//conversionConfig.setCachePath(cachePath);
		//conversionConfig.getFontDirectories().add(fontsPath);
		// Generate cache 
		//conversionConfig.setUseCache(true);
		
		
   ImageSaveOptions imagesaveOption = new ImageSaveOptions();
	imagesaveOption.setConvertFileType(ImageSaveOptions.ImageFileType.JPG); 
	imagesaveOption.setJpegQuality(100);
	imagesaveOption.setHorizontalResolution(300);
	imagesaveOption.setVerticalResolution(300);
	convertedDocumentPath = conversionHandler.<List<String>>convert(guid, imagesaveOption);
	for (int i = 1; i <= convertedDocumentPath.getPageCount(); i++) {
		convertedDocumentPath.save(guid + i + "." + convertedDocumentPath.getFileType(), i);
		logger.info(guid + i + "." + convertedDocumentPath.getFileType());
		}

com.groupdocs.conversion.internal.c.a.w.internal.uN: Could not create the bitmap with the specified parameters: java.lang.OutOfMemoryError:
for this error (https://stackoverflow.com/questions/477572/strange-out-of-memory-issue-while-loading-an-image-to-a-bitmap-object) here is some solution which can help up to solve this

and for documents to PDF conversions its working fine
but time taken to process is not relevant
for document(all type of MS office and open office formats) to PDF conversion
for 30 documents single threaded its taking 52 seconds
for 30 documents 10 threaded its taking 35 seconds

does GroupDocs.conversion Relly works with Multithreaded environment ?

Thank you,
Swapnil.


#2

@swapnilkumbhar,

Can you please share a simple console application (without any third party JAR and including problematic files) using that we can reproduce this issue at our end?


#3

Hi,
I have attached ShareToGroupdocs.zip in that Files folder contains problem files and TestGD folder contains test code i have used.
Those are not a problem files because in single threaded mode it works fine but for 10 threads am getting above error.
TestGD folder you can import it as maven project in eclipse it has main class Test.java
accepting 3 args inputdir, outputDir, numOfThreads
you can create multiple copies of files (min 50 files) from folder Files/InputFiles and then run code sample with 10 threads to reproduce error.
Please note that have allocated more heap space -Xmx3072m still am getting this error .
and also found that (.pot) files are not supported

Best Regards.


#4

@swapnilkumbhar,

Thanks for the project.
Can you please also specify the steps to run it successfully. We opened this project in Eclipse, added JAR file externally. When tried to run it. We faced this.jpg (91.0 KB) exception.


#5

@atirtahir3
You can follow this
in Main method can you just replace first three line with this
1. String inputDir = “\ShareToGroupdocs\Files\InputFilesForThreads”; //add complete path of InputFilesForThreads folder i have shared so that it reads files from it.
2. String outputDir =“path/to/output/directory”; //output directory where you want output
3. String numOfThreads =“10”; // number of threads to run

OR

You can mention in Run-configuration
Right click in Test.java -> run as -> run configuration -> go to arguments tab
add three arguments there
First is Complete path of InputFilesForThreads folder i have given
Second is Complete path of output folder where you want output
Third is Number of threads to run use 10 threads.

Thanks.


#6

@swapnilkumbhar,

This issue is reproduced at our end. We have logged it in our internal issue tracking system with ID : CONVERSIONJAVA-768. Now it is under investigation, we’ll notify you as there is any further update.

Yes, this file format is not supported. However, we have requested this as a new feature with ID : CONVERSIONJAVA-769. You’ll be notified as there is an update.