Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdf Memory Leak V2023.2.14.0 Options
Paul
Posted: Tuesday, June 6, 2023 6:52:29 AM
Rank: Newbie
Groups: Member

Joined: 6/6/2023
Posts: 5
Hi there,

Using the latest EO components V2023.2.14.0 I'm experiencing a memory leak + crash when attempting to convert an HTML file to PDF. I can supply the exception dialog output, as well as code sample and source HTML file.

There are no images, but 10,000 table rows. I have tried setting EO.Base.Runtime.EnableEOWP = true, but the issue remains. The exception stack trace is:

Code: C#
EO.Pdf.HtmlToPdfException
  HResult=0x80131500
  Message=WebView has failed
  Source=EO.Pdf
  StackTrace:
   at EO.Pdf.HtmlToPdfException.pnid(Exception abf)
   at EO.Internal.mkem.xvco(mken wn)
   at EO.Internal.mkem.xvco()
   at EO.Pdf.HtmlToPdfSession.RenderAsPDF(PdfDocument doc)
   at EO.Pdf.HtmlToPdf.etni.eabc()
   at EO.Internal.mkjp.gtyn[a](dhft`1 bro)
   at EO.Pdf.HtmlToPdf.ConvertUrl(String url, PdfDocument doc, HtmlToPdfOptions options)
   at EO.Pdf.HtmlToPdf.ConvertUrl(String url, String pdfFileName, HtmlToPdfOptions options)
   at EO.Pdf.HtmlToPdf.ConvertUrl(String url, String pdfFileName)
   at PDF_Test_01.Program.Main(String[] args) in C:\Users\pmulvey\source\repos\PDF_Test_01\PDF_Test_01\Program.cs:line 14

  This exception was originally thrown at this call stack:
    EO.Internal.mkjm.gfat(string, System.Exception)
    EO.Internal.mkjm.gfas()
    EO.Internal.mkjm.gfar(string)
    EO.Internal.mkjs.favl(EO.Internal.mkjs.dfxf, EO.Internal.mkjq, EO.Internal.mkjs.dfxh, bool)
    EO.Internal.mkjs.xvcs(EO.Pdf.HtmlToPdfOptions, float, float, EO.Internal.mkel, System.Collections.Generic.List<EO.Internal.mkio>, EO.Internal.mken)
    EO.Internal.mkem.xvcs(EO.Internal.mken, out float)
    EO.Internal.mkem.xvco(EO.Internal.mken)

Inner Exception 1:
cjmn: Failed on command 4:


Please let me know what I can provide to look into this further.

Many thanks,
Paul
eo_support
Posted: Tuesday, June 6, 2023 11:48:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

Can you try to isolate this problem into a test project and then send the test project to us? See here for more details:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
Paul
Posted: Tuesday, June 6, 2023 12:10:16 PM
Rank: Newbie
Groups: Member

Joined: 6/6/2023
Posts: 5
I've sent that via email - let me know if there's any problems!

Thanks - Paul
eo_support
Posted: Wednesday, June 7, 2023 10:37:24 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Thanks for the test project. We are able to reproduce the problem here. We will reply again as soon as we have an update.
Paul
Posted: Monday, June 12, 2023 4:03:52 AM
Rank: Newbie
Groups: Member

Joined: 6/6/2023
Posts: 5
Thank you!
eo_support
Posted: Wednesday, June 14, 2023 11:40:59 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

This is just to let you know that we have posted a new build (23.2.34) that included some optimization but still CAN NOT sucessfully convert your test page in our test system. We have made signficiant progress (the previous build crashes around page 30 and the new build crashes around page 130). The same page would crash Google Chrome browser as well if you choose to print it. So we are still working on this. In the mean time you can try the new build and see if it works on your system.

Thanks!
Paul
Posted: Wednesday, June 14, 2023 12:23:37 PM
Rank: Newbie
Groups: Member

Joined: 6/6/2023
Posts: 5
Thanks for the update. I can confirm the new build still isn't able to resolve the issue on my test system. Appreciate you're still working on this.

Many thanks,
Paul
eo_support
Posted: Thursday, June 15, 2023 9:38:40 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

We have a new test build that was able to convert your file in our environment. Please see your private message for the download location and let us know if it works for you.

Thanks!
Paul
Posted: Monday, June 19, 2023 6:04:34 AM
Rank: Newbie
Groups: Member

Joined: 6/6/2023
Posts: 5
Hi there,

I've tested the new build, thanks for your efforts! Whilst it now successfully outputs the given quantity of items, it will still fail with an out of memory error if I increase the number of table rows to something like 30,000 lines of information. This is a bit of an unknown quantity at our end, with potentially tens of thousands of individual rows.

Even with the original 10,000 items, the memory usage will max out during PDF processing on my development machine (~20GB) and this has caused memory allocation issues elsewhere in the running of our software.

I was just wondering why is so much memory required? And is there a way to set an upper limit in memory usage of the EO components? So for example, PDF processing could pause until memory is reclaimed and drops below the upper limit - something like that?

Many thanks,
Paul
eo_support
Posted: Monday, June 19, 2023 10:20:09 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

You may wish to consider redesign your HTML into multiple chunks, then convert each chunk separately, then merge them into one result PDF file. We did some optimization on the browser engine that made the original HTML work by removing some extra buffering used by onscreen rendering, which the HTML to PDF process does not need. But we are not able to signficantly reduce the memory further. The ecessive memory usage seems to have to do with the Chromium browser engine keeping "context" information for the rendered element (such as a table row). Due to Chromium rendering engine being extremely large and complex, we are not in a position to significantly alter how rendering (and associated memory usage) are handled inside the browser engine. So there will always be a limit on how many rows your HTML file can have. In another word, there is no way to make it "always" work. We will however continue to test and analyze memory usage to gain better understanding on various contribution factors.

Google Chrome browser shows the problem as well. If you load your page and then try to print it (another way to trigger the rendering engine to render ALL pages instead of just what's visible on screen), the browser would crash. It is possible that the Chromium team would consider this to be problem as well and "fix" it on their end in future releases, in that case the fix will be in our product when we update our Chromium engine to a newer fixed version.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.