EmptyValueException: ModDate value is empty in High-Load Scenarios

Hi, sorry for this unspecific Error report, but we have a hard time reproducing it ourselves:
Using this Code to convert a PDF-Document to PDF-A results in the subsequent Exception, but only in high-Load Situations. Maybe you can give us a hint what we should change:

    public static byte[] ConvertDocumentToPdfA(Document pdfDocument, PdfFormat pdfFormat, ITrace trace = null)
    {
        byte[] pdfConversionLogBytes;
        bool convert;
        using (var pdfConversionLogOutputStream = new MemoryStream())
        {
            convert = pdfDocument.Convert(pdfConversionLogOutputStream, pdfFormat, ConvertErrorAction.Delete);
            pdfConversionLogBytes = pdfConversionLogOutputStream.ToArray();
        }

        string pdfConversionLog;
        using (var ms = new MemoryStream(pdfConversionLogBytes, false))
        {
            var xElement = XElement.Load(ms);
            pdfConversionLog = xElement.ToString();
        }

        if (!string.IsNullOrEmpty(pdfConversionLog))
        {
            trace?.Info("Messages from conversion of 'PDF' to '{3}' (Aspose.Pdf.Document.Convert() returned: '{0}'):{1}{2}{1}",
                convert, Environment.NewLine, pdfConversionLog, pdfFormat);
        }

        using (var pdfOutputStream = new MemoryStream())
        {
            pdfDocument.Save(pdfOutputStream);
            return pdfOutputStream.ToArray();
        }
    }

This is the Exception that happens sometimes when we generate more than 50 Documents:

An exception occured generating pdf-document ‘Key Information Document (PDF)’
Aspose.Pdf.EmptyValueException: ModDate value is empty
at [1] .[1]


()
at .1
at
. [1]( [1],


)
at [1] . [1](Stream [1])
at . [1](Stream [1])
at Aspose.Pdf.Document.Save(Stream output)
at Lpa.DocFramework.AsposeWrapper.PdfUtils.ConvertDocumentToPdfA(Document pdfDocument, PdfFormat pdfFormat, ITrace trace) in AsposeWrapper\PdfUtils.cs:line 60 which is the pdfDocument.Save(pdfOutputStream); Command at the End of our code.

Do you have a tip what we could change to avoid this spurious problem?
Best regards…
Matthias

@mheuer,

Kindly create a small project application and make sure that it reproduces this error in your environment, and then send us a Zip of this project. We will investigate and share our findings with you.

Sorry, we cannot reliably reproduce this error. We were hoping that you could glean some Information from the Error message or the Stacktrace.

@mheuer,

It appears as it is due to some problematic PDF document. You can apply a code check to filter out the problematic PDF document and share this document with us. Once the error is replicated in our environment, then we will investigate and fix it.

OK, but since the Problem is rare, this might take some time. Should I leave this Item open or would you rather close it and have me open a new one as soon as we have a sample?
Best regards…
Matthias

@mheuer,

You might share the problematic PDF document in this thread as soon as you get a sample. We will investigate as per the above code example and details of the scenario.

Hi again, at last I could generate an example that reproduces this error with high probability.
The attached Zip File contains a C# Project with the latest 18.3 Aspose PDF and Word DLLs and tries to convert the same FailedPdfCostInformationDocument.Layout.docx Word Document 8 times in parallel Threads, which usually triggers this Exception.

Aspose.Pdf.EmptyValueException
HResult=0x80131500
Message=ModDate value is empty
Source=Aspose.PDF
StackTrace:
at . ()
at .( )
at ​ . ( , )
at . ()
at . (Stream )
at . (Stream )
at Aspose.Pdf.Document.(Stream )
at Aspose.Pdf.Document.Save(Stream output)
at PdfBugRepro.PdfUtils.ConvertDocumentToPdfA(Document pdfDocument, PdfFormat pdfFormat) in C:\DocumentFramework\V13_3\PdfBugRepro\PdfUtils.cs:line 61

The ZIP File once again… I don’t see it. Please come back to me if you can’t find it either…

Uploaded with a different Browser…

@mheuer,

We could not find the ZIP attachment file to your posts. If the ZIP file size is more than 3MB, then kindly upload to any free file sharer sever, e.g. Google drive and share its download URL with us. Your response is awaited.

PdfBugRepro.zip (560.9 KB)
Ah, now it works. I removed the 18.3 DLLs from the zip file.
This Test-App converts from *.docx to PDF/A in multiple Threads just like our Web-Server does.
This Error only appears in multithreaded Scenarios, even when I force them to be single-threaded via Semaphore or lock (you see the commented out statements in PdfUtils.cs Line 97 didn’t help, it only reduced the likelihood of this error)
Thanks for your help…
Matthias

1 Like

@mheuer,

We have tested your project application in our environment and unable to replicate the said error. The document is being converted 8 times. Kindly list down all steps which could help us to replicate this error in our environment. Snapshot: https://i.imgur.com/7ViyU3V.png

Hi, thank you for trying this out. It may be that you have to increase the Number of Documents to reproduce the Error. When I set it to e.g. 18 in Line 21 of Program.cs, it crashes every time on my Computer. With 8 it seems to sometimes not crash. Please increase the Number until you can reproduce the error.

Regards…
Matthias

I have the same problem in my code

@mheuer,

We managed to replicate the said error in our environment. It has been logged under the ticket ID PDFNET-44378 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

@stanlife,

Kindly send all details of the scenario, including source documents and code. We will investigate your scenario in our environment and share our findings with you.

Hi, thank you for creating the Ticket. Can you give an estimate on when this will be tackled, because we have to communicate that to our customers.

@mheuer,

The linked ticket ID PDFNET-44378 is pending for the analysis and not resolved yet. We will investigate as per the development schedules and let you know once a significant progress has been made in this regard.

Hi, this Issue (PDFNET-44378) is unfortunately reported as critical by four of our largest Customers (among others HSBC and UniCredit) and they expect an answer when we will resolve it.
How can we speed up the process?
Regards…
Matthias

@mheuer,

The linked ticket ID PDFNET-44378 is not resolved yet. It could take time because there are other high priority tickets in the queue. In order to escalate priority, we recommend our clients to post their critical issues (ticket Ids) in the paid support forum. Please refer to this helping link: Aspose support options.

We had a chat with the Aspose-Sales-Team to buy the paid support. But before investing money we need a rough estimation about the schedule, when the PDFNET-44378 will be resolved and available to us.
If we buy the paid support and the fix is not available within the next 1 – 2 month, it is useless for us. This bug is very critical for us.
Our software runs at banks worldwide and our customers are increasingly angry with our company and Aspose. We have to decide whether we invest the money into Paid Support or implement a workaround. A fix from Aspose’s side would be appreciated and other customers would benefit from it as well.
Kind Regards…
Matthias