PdfFileEditor is not threat save (sample prject contained)

Hi,


I am working on a large application that need to concatenate pdf’s on the fly and serve them to the user. This happens in a multi user environment. Unfortanelly after testing the PdfFileEditor.Concatenate function in a multi threat mini application we noticed random failures.

I’ve attached a sample project that illustrates the issue. A VS 2010 project, .net 4.0, creates 2 threats that try to concatenate 5 files each.

Please provide a solution as soon as possible as this is critical to our business.

Thank you,

Hi,

Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 6.2.0 and I am unable to notice any issue. The PDF documents are being concatenated and I am able to see the resultant PDF files. Please take a look over the attached resultant PDF’s that are generated over my end. Can you please share, which version of Aspose.Pdf for .NET you are using ? We apologize for your inconvenience.

Hi,


I have 6.1.0, was there a issue with 6.1 ?

Regards,

I've seen this in 6.2.0 as well, although I was using PdfFileEditor.SplitToPages.

The problem I had was that all of the output files would not open, instead I would receive the following error:

'There was an error opening this document. The file is damaged and could not be repaired.'<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

calin:
I have 6.1.0, was there a issue with 6.1 ?


Hi,

Sorry for delay in response. I am not sure if the issue occurred in v6.1.0 but as per my observations, I did not encounter any issue when tested with v6.2.0. We always encourage our customers to use the latest available versions because they include hotfixes for issue reported earlier. I think a similar issue related to PDF concatenation, might have been fixed in previous release. Please try using v6.2.0 and in case you face any problem, please feel free to contact.
Dave Moyle:
I've seen this in 6.2.0 as well, although I was using PdfFileEditor.SplitToPages.

The problem I had was that all of the output files would not open, instead I would receive the following error:

'There was an error opening this document. The file is damaged and could not be repaired.'



Hi Dave,

Thanks for using our products. Can you please share the source PDF document so that we can test the scenario at our. We are really sorry for this inconvenience.

It really doesn't matter what document you use, but I have include 1 along with a sample project with a couple of quick examples of how different results can be returned.

Hi Dave,

Thanks for sharing the sample project. I have tested the scenario using Aspose.Pdf for .NET 6.2.0 and as per my observations, the pages are properly being extracted. I have executed the code you have shared and when I have selected the option 1, pages are properly being extracted. Please find attached the documents that are generated over my end. Can you please try using v6.2.0 and in case you still face any problem, please share some details regarding your working environment.

More along, I have also tried splitting the pages of PDF document into individual pages, and as per my observations, I am unable to notice any issue when I have used the following code snippet.

[C#]

//create PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
int fileNumber = 1;
//split to pages
MemoryStream[] outBuffer = pdfEditor.SplitToPages(@“D:\pdftest\ThreadingSample\ThreadingSample\Numbers.pdf”);
//save individual files
foreach (MemoryStream aStream in outBuffer)
{
FileStream outStream = new FileStream(@“D:\pdftest\ThreadingSample\ThreadingSample” +
fileNumber.ToString() + “.pdf”, FileMode.Create);
aStream.WriteTo(outStream);
outStream.Close();
fileNumber++;
}

Hi

I can confirm to you that I am already using Aspose.Pdf for .NET 6.2.0. (.NET 4.0 Full Framework Version)

Option 1 in the sample application was a synchronous, non-threaded sample and is not expected to fail. The output files include the word Valid in the filename, as I always expect them to open successfully.

I can see from the filenames include in your response files that they were generated using option 1. Can you please re-run the sample, using Options 2 - 4. All of these options are using varying degrees of threading, and will at least attempt to expose the problem.

The sample code that you have included above is synchronous, local variable, non-threaded code which I do expect to ever expose a thread-safety issue (be it in Apose code or anyone elses). Although I had initially reported an issue in the SplitToPages method, it requires a much more complex scenario to expose the issue. So for simplicity my sample used the Extract method instead, where the problem is extremely easy to reproduce. Perhaps we can focus on the Extract method for now.

As for my working environment, I am running Windows Server 2008 R2 on a machine with 12Gb ram and a Quad Core W3520 (2.67Ghz) Xeon. The CPU has Hyper-Threading enabled, so I see 8 cores inside of Windows.

Cheers
Dave

Hi
Is there any progress being made on this issue? Or am I best to raise a new one?

Thanks
Dave

Hello Dave ,

Thanks for your patience and sorry for replying you so late. I have tested the scenario with latest release version and I am able to notice the same problem. For the sake of correction, I have logged this issue as PDFNEWNET-31485 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. We are really sorry for this inconvenience.

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


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

Confirmed as fixed

Thank you