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

Free Support Forum - aspose.com

Thread safety issue

Hi,

Using 2011.12.01 version of Aspose.PDF.dll we have encountered a multithreading problem.

According to documentation all public methods of Page class should be ThreadSafe, but attached code fails with an ArgumentException "Item has already been added. Key in dictionary: ' ' Key being added: ' '". If there is a lock on page.Accept call everything is working as expected.

We would like to run similiar code in order to improve performance. Page.Accept method is the most time-consuming operation and we are working with multiple files of > 300 pages.

Code do reproduce: (assuming we have 10 sample files, each of them has 3 pages):

private static readonly object _lock = new object();
static void Main(string[] args){

List<string> docs = new List<string>();
for (int i = 0; i < 10; i++) docs.Add(String.Format("TestData\\sample{0}.pdf", i));
Parallel.ForEach(docs, ParseDocument);
}

static void ParseDocument(string path)
{
Document document = new Document(path);
foreach(Page page in document.Pages)
{
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber();
//lock (_lock)
page.Accept(textFragmentAbsorber);
}
}

Hi Wojciech,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the sample code.<o:p></o:p>

We have found your mentioned issue after an initial
test. Your issue has been registered in our issue tracking system with issue
id: PDFNEWNET-33013
. You will be notified via this forum thread
regarding any update against your issue.<o:p></o:p>

Sorry for the inconvenience,<o:p></o:p>

The issues you have found earlier (filed as PDFNEWNET-33013) have been fixed in this update.


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

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan