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

Free Support Forum - aspose.com

Generated document contains data of another document in multi-threading environment

Hi Folk,

We are Aspose’s customer and using Aspose.Words (Implementation-Version: Release-Date: 2015.02.28) to merge Word template and generate PDF file. The issue we see is that the displayed value of some fields in the generated PDF file is not correct. We are generating PDF in a multi threading environment where multiple documents are being merged concurrently in one Aspose server. When we check the unexpected field value we suspect these value come from another document which is being merged at the same time of this document in issue. That seems the data used for merging is leaked between threads. We have seen this issue from our own customer’s PDF for the second time in recent half year. It doesn’t happen often but serious to us because it is a legal document. Another important information might be helpful, the fields that got incorrect value are mostly the merge fields which appear more than once in the Word template. For example <<Invoice.Total>> appears twice in the template, and in the final PDF we see one of the merged value of <<Invoice.Total>> is wrong.

Please help us confirm from your community experience if this is a known issue, has it been fixed from certain version, and any suggestion to us for better tackling this issue?

Thank you very much.

Best Regards,


Thanks for your inquiry.

Aspose.Words for Java is multi-thread safe as long as only one thread works on a Document at a time. It is a typical scenario to have one thread working on one Document. Different threads can safely work on different Document instances at the same time.

Please note that Aspose.Words for Java supports multi-threading. Document objects are independent of each other and as long as only one thread at a time is allowed to modify a Document, multiple threads can be processing any number of Documents at the same time.

Please upgrade to the latest version of Aspose.Words for Java 17.2.0 and see how it goes on your end? Hope, this helps.

In case the problem still remains, please attach the following resources here for testing:

  • Your sample input Word document(s)
  • Aspose.Words generated output PDF files showing the different behavior
  • Please create and attach a standalone Java application (source code without compilation errors) that helps us to reproduce your problem on our end.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,


We found the issue of Aspose.Words under multiple thread environment. The sample code(PDFTest.zip) is uploaded and it is a standalone java project you can import it into Eclipse directly. In the uploaded code, we start 100 threads to generate PDF files and each thread will generated 30 PDF files with the same template and datasource. We provide two datasources for the PDF generation, one only provide ‘1’ as the merge field value, and the other only provide ‘2’ as merge field values. The ideal PDF file is either only show ‘1’, or only show ‘2’. But we found some PDF files are mixed with ‘1’ and ‘2’.

The correct and wrong PDF are both uploaded. We also tried to generate word doc or Text doc, both doc types have the same issues.

After we do further investigation, we found the number format defined for number type merge field may be the root cause, for example, the following merge field is defined with format,
«Invoice.Total # $###,###,##0.00»
If we remove all the format from all the merge fields, then all the PDF files generated are correct.

Could you please help to debug and provide solution?



Thanks for your inquiry. You’re using a very old version of Aspose.Words for Java 15.2.0.

After an initial test with Aspose.Words for Java 17.2.0, we were unable to reproduce this issue on our end. We would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link:

Also, please change the following method signature:

<pre style=“font-family: “Courier New”; font-size: 9pt;”>private static void generateDocs(final String template) throws Exception {

Hope, this helps.

Best regards,


Thanks for the reply.
It is a big effort for us to upgrade the lib. So could you please try our sample code with the 15.2 lib and provide some workaround if it is possible.



I tried with the latest aspose lib, we still could reproduce the issue stably. Could you please run the sample code and investigate what is wrong?

You can get the following output in console when run the sample code. There is one thing I would like to mention, we are running the sample code with 8 cores CPU, which make sure the lib is working in a concurrent environment and the file format is TEXT to make sure we only compared text.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}


























Hi Tony,

Thanks for your inquiry. For the sake of any correction, we have logged this problem in our issue tracking system as WORDSJAVA-1497. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for your inconvenience.

PS: Please note that we don’t provide support for older versions of Aspose.Words and we do not provide any fixes or patches for old versions of Aspose products either. We always encourage our customers to use the latest versions of Aspose.Words (to date it’s 17.2.0) as it contains newly introduced features, enhancements and fixes for issues reported earlier. Thanks for your understanding.

Best regards,


Thanks for pay attention to this issue.
This issue is urgent for us, we found more customers are potential under the risk, how could we know your progress on WORDSJAVA-1497.


Hi Awais,

Is this confirmed as defect by your development team? We have quite a number of documents impacted on production, which are all legal documents. Please respond.


Hi Tony,

Thanks for your inquiry.

Yes, we can confirm that this is an issue in Aspose.Words. Our product team has completed the analysis of this issue and the root cause has been identified. They’re actively working on implementing the fix. We will inform you via this thread as soon as this issue is resolved. We apologize for any inconvenience.

Unfortunately, there is no direct way that you can use to track issues by yourself. But, you are welcome to ask the issue status via forum threads. We will verify the status from our internal issue tracking system and reply you back.

Best regards,

Hi Awais,

Please inform us as soon as the fix is available. Running into failure on the very basic use case with a commercial licensed library, We are disappointed. Concurrency can’t be more general for enterprise application. For that, you can think about how much we are impacted. Please help on raising the urgency of this ticket.

Thanks and Regards,

Hi Tony,

Thanks for being patient. We have passed your concern to our product team and will keep you posted on further updates.

Best regards,

Hi Awais

Any update on the fix?


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

This message was posted using Notification2Forum from Downloads module by aspose.notifier.