We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Multithreading BROKEN (Aspose.Words Java 17.6)

Hi Aspose,


we use Apose.Words in a multi-threading environment. We wanted to upgrade from 15.4 to 17.6 but sadly have noticed that Aspose.Words breaks when loading documents in more than one thread!

The exception is:

Caused by: com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at com.aspose.words.FileFormatUtil.zzZ(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at io.prc.violet.document.engine.ImporterIssue.lambda$main$0(ImporterIssue.java:24)
… 3 more
Caused by: java.lang.NullPointerException
at asposewobfuscated.zz99.zzZ(Unknown Source)
at asposewobfuscated.zz9K.zzZ(Unknown Source)
at asposewobfuscated.zzR9.zz4(Unknown Source)
at com.aspose.words.zz92.zzZ(Unknown Source)
at com.aspose.words.zz85.read(Unknown Source)
at com.aspose.words.zzZ9E.read(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
… 7 more

Please reproduce with this code:
final ExecutorService es = Executors.newFixedThreadPool(10);
for (int i = 0;i<1000;i++) {
es.execute(() -> {
System.out.println(Thread.currentThread().getName());
try {
new Document(“Template.docx”);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
es.shutdown();
es.awaitTermination(10, TimeUnit.MINUTES);
You can find ‘Template.docx’ as attachment, but I’m pretty sure it happens with every document.

Hi there,


Thanks for your inquiry. We have tested the scenario and noticed the regression issue. We have logged a ticket WORDSJAVA-1607 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

Best Regards,

The issues you have found earlier (filed as WORDSJAVA-1607) have been fixed in this Aspose.Words for .NET 17.7 update and this Aspose.Words for Java 17.7 update.