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

Free Support Forum - aspose.com

Aspose.PDF thread safety issue


We have identified a race condition within Aspose.PDF. One of the static initialiser does not appear to have appropriate locking - which results in an IndexOutOfRangeException when two threads happen to require the same static class (likely actually related to the use of the Dictionary as it resizes during initialisation).

Stack trace:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at #=z5BcB3MnzTN5zTjcSpFZzt5YGUSXpP$bosA==.#=zX_yZuvqwEUxVSE1auA==(String #=ziCubrTc=, Boolean #=zZ1_8Arw3mZ4mm_PV0Q==)
at #=z1zvw74KaVc_vOqdjPN1V_DCoIMVMvhRT6Br2JQRiG5_ixzrkKw==.#=z9slWFFwduZXCcs6UuQ==(String #=z25t_zLofddYO85FlOg==, LanguageTransformation #=zsyG1iS_gXuz4)
at #=zw58R9s_5O1ulLgA8vWckJMHr9bFppapQmvSuxLrUiAdP5uFiabCU97A=…ctor(List`1 #=zM8MKs_C0c822, Rectangle #=zKd_6VbA=, Boolean #=zYUfVFnzP9dct)
at #=zxlvJK7zKQ1Tn3qiwnS026VQGz3g2ZeMXDfOJY5ycXFtoCNokpn3E62TYDgpd.#=zTSC3zoU=(String #=zjpRkLjQAjmw7, Boolean #=zu8Zoov1jfpSPms6duA==)
at Aspose.Pdf.Text.TextAbsorber.Visit(Page page)



Thank you for contacting support.

Please note that Aspose.PDF for .NET is multi-thread safe API as long as only one thread works on one document at a time. Likewise, different threads can safely work on different documents at the same time. Would you please share SSCCE sample application along with the source files so that we may try to reproduce it in our environment and help you out. Before sharing requested data, please ensure using Aspose.PDF for .NET 19.2.


I agree that it should be thread safe - please could you just ask a developer to look at that class (#=z5BcB3MnzTN5zTjcSpFZzt5YGUSXpP$bosA==)?

From what we can see its related to some kind of language normalisation (though - its hard to tell in an obfuscated format!). The test PDF we used was a PDF with many languages in it - against multi-threaded code (the same code as the other post I raised).



Thank you for the details.

Kindly share source PDF document with us so that we may reproduce it with your code and investigate further to help you out.