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

Free Support Forum - aspose.com

Multithreaded use hangs

Hi,

Using Aspose PDF to extract pages as images with multiple threads hangs about once every day.

They all hang with the exact same stack trace:

mscorlib.dll!System.Collections.Generic.Dictionary`2.FindEntry+0x6b
Aspose.Pdf.dll! .+0xdc
Aspose.Pdf.dll! . ​+0x9f
Aspose.Pdf.dll! .+0x7f
Aspose.Pdf.dll! .+0x64a
Aspose.Pdf.dll! . ​+0x25
Aspose.Pdf.dll! . ​+0x8a0
Aspose.Pdf.dll! .+0x25
Aspose.Pdf.dll! . ​+0xe6
Aspose.Pdf.dll! .+0x11a5
Aspose.Pdf.dll! . ​+0x108
Aspose.Pdf.dll! .+0x7b7
Aspose.Pdf.dll!Aspose.Pdf.Devices.ImageDevice.+0xe2
Aspose.Pdf.dll!Aspose.Pdf.Devices.PngDevice.Process+0x18

Or from a dump file:
mscorlib.dll!System.Collections.Generic.Dictionary<float, >.FindEntry(float key)
Aspose.Pdf.dll! .<float, >. ​(float , )
Aspose.Pdf.dll! .(string , object )
Aspose.Pdf.dll! . ​(System.Collections.Generic.List , bool )
Aspose.Pdf.dll! .(string , System.Collections.Generic.List , System.Collections.Generic.List< > , )
Aspose.Pdf.dll! .( , , bool , bool )
Aspose.Pdf.dll! . ​(​ , , , )
Aspose.Pdf.dll! . ​( )
Aspose.Pdf.dll! .( )
Aspose.Pdf.dll! . ​( , System.Collections.Generic.List< > )
Aspose.Pdf.dll! . ​(​ , , , out )
Aspose.Pdf.dll! .(out )
Aspose.Pdf.dll!Aspose.Pdf.Devices.ImageDevice.(Aspose.Pdf.Page )
Aspose.Pdf.dll!Aspose.Pdf.Devices.PngDevice.Process(Aspose.Pdf.Page page, System.IO.Stream output)

Are these threads using some static or shared dictionary?

Since most of these files are email attachments, there is a small possibility that 2 threads use a duplicate document, but always from two separate files.

Our version of Aspose: 17.2.0

@glenn.volckaert

Thanks for contacting support.

It is hard to determine actual reason of the exception that you have shared without testing the scenario in our environment. However, could you please try using latest version of the API i.e. Aspose.PDF for .NET 19.3. In case issue still persists, please share a sample console application with sample input files. We will test the scenario in our environment and address it accordingly.

Hi Asad,

It is quite hard to recreate the same situation in a console application. We are processing thousands of files a day. Last night it failed after processing about 17000 files. That makes it very hard to single out which one were causing this, or even whether it is caused by specific documents which I doubt because most of them were already opened in aspose before. I seems like a race condition.

With the page number limits posed on the trial version I can’t test this in production.

I do have a memory dump, but we’ll need an NDA before I can send it over because it has customer data in it.

Kind regards,

Glenn

Summary

This text will be hidden

@glenn.volckaert

Thanks for your feedback.

We definitely understand the complexity of the scenario however, we are unable to proceed any further without replicating the issue in our environment. The Aspose.PDF API is multi-threaded safe API as long as one document is accessed by on thread at a time. There could be any issue in your application during multi-threaded processing which can only be investigated if it is reproducible in our environment.

We do not sign or provide any NDA as the respective clauses are already included in the EULA which you accept while purchasing the API. Furthermore, the files and data shared by you is only used for testing purposes and removed from our side once investigation is complete. We have also marked this post as private so the files shared here will only be accessible by you and Aspose Staff.

In case you want to share other private information, you can send us a private message with that. Please click over username and press blue Message button to send us private message. Please try to provide a narrowed down code snippet which you are using for image extracting in multi-threading mode. We will try to reproduce the issue with some of our sample files and share our findings with you.