Hello,
We have an application that uses your product, and recently we are facing some issues on production.
Basically we download one pdf file from our blob storage as a stream, load it in the Document
class, do some modifications, and save it to a new .pdf file.
We checked our code, and seems that there is nowhere, where we access a same document (phisical, or instance of the Document
class, but we still have this concurrency exceptions in various places. They are 3 types and since some class names are encoded, we can’t trace the reason for that.
I’ll attach the exceptions we get in a .txt file.
Aspose.PDF Exceptions.zip (2.4 KB)
I’ve tried to reproduce the behavior in a sample test project, but it is not happening there and everything is working fine. Here is the test code I used:
internal class Program
{
static void Main(string[] args)
{
for (int i = 0; i <= 10; i++)
{
new Thread(SavePdf).Start();
}
Console.WriteLine("Threads initialized");
Console.ReadLine();
}
private static void SavePdf()
{
var path = @"C:\temp\converted0000.pdf";
var pdf = new Document(path);
//pdf.Pages.Add(pdf.Pages[1]);
pdf.Pages.Delete(2);
var savePath = @$"C:\temp\converted0000_{Thread.CurrentThread.ManagedThreadId}.pdf";
pdf.Save(savePath);
Console.WriteLine("Document saved");
}
}
if I remove the Thread.CurrentThread.ManagedThreadId
and try to save in one file it throws and error that the file is used by another process, and not anything similar to the exceptions we face on production.
I hope this helps understand my problem. If any additional information is needed, please do not hesitate to ask for it.
Unfortunately the pdf documents causing this issues contain sensitive information and can not be uploaded here.
The version we are currently using is 23.2.0.
Best regards,
Yulian Dimitrov
STP Group