Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdf.MaxConcurrentTaskCount Exception Help Options
lucianchen
Posted: Tuesday, June 3, 2025 10:08:30 AM
Rank: Newbie
Groups: Member

Joined: 6/3/2025
Posts: 4
Hi Team,

We got a lot of exceptions due to the following exceptions on our PROD environment.
EO Nuget package version we're using: 2025.1.6

```
22:40:36 Exception: Can not create additional conversion task. Please increase HtmlToPdf.MaxConcurrentTaskCount. at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo) at System.Environment.get_StackTrace() at EO.Base.BaseException..ctor(String ltc, Exception ltd) at EO.Pdf.HtmlToPdfException..ctor(HtmlToPdfErrorCode ace, Int32 acf, String acg, Exception ach) at EO.Pdf.HtmlToPdfException.ispm() at EO.Internal.dpty.hkpn(mwhd bto, dptw& btp) at EO.Internal.dpub.scdw() at EO.Internal.dpub..ctor(mwhd btr, HtmlToPdfOptions bts) at EO.Pdf.HtmlToPdfSession.gvjq(HtmlToPdfOptions aaw, WebView aax) at EO.Pdf.HtmlToPdfSession..ctor(HtmlToPdfOptions aas, WebView aat, HtmlToPdfSession aau, ResourceHandler aav) at EO.Pdf.HtmlToPdfSession.Create(HtmlToPdfOptions options, ResourceHandler resourceHandler) at EO.Pdf.HtmlToPdf.ehdk(HtmlToPdfOptions adz, frtk`2 aea, Boolean aeb) at EO.Pdf.HtmlToPdf.ehdj(HtmlToPdfOptions adx, frtk`2 ady) at EO.Pdf.HtmlToPdf.ConvertUrl(String url, PdfDocument doc, HtmlToPdfOptions options) at EO.Pdf.HtmlToPdf.ConvertUrl(String url, PdfDocument doc) at
```

We see there was an old post discussing this topic:
https://www.essentialobjects.com/forum/postst12082_HtmlToPdfMaxConcurrentTaskCount-Error.aspx

And we confirm that we're using the default concurrent task count number (25).
The backend service in which it invokes the `EO.Pdf.HtmlToPdf.ConvertUrl` function is using a 8 max thread pool so it's less than the 25 concurrent tasks count set by EO as default value.

After the library threw this error aggressively, it stopped working until we restarted the service.
We checked out service log and found there were 33 EO exceptions before it repeatedly throw the MaxConcurrentTaskCount exception for ALL subsequent invocations to `EO.Pdf.HtmlToPdf.ConvertUrl`.

And 33(the exceptions we see before MaxConcurrentTaskCount failures took over) = 25(default EO max concurrent task count) + 8(our service concurrent task account).
This makes us think is it possible that the max concurrent task count somehow didn't decrease after exceptions happened.



The other exceptions we see before the MaxConcurrentTaskCount exepctions are:

"Exception: WebView is closed. Reason: EngineCrash at System.Environment.GetStackTrace": 21 times.

Exception: WebView is closed. Reason: EngineCrash at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo) at System.Environment.get_StackTrace() at EO.Internal.gtmo..ctor(Engine acy, String acz, Exception ada) at EO.Internal.dptv.faoi(String btb, Exception btc) at EO.Internal.dptv.faoh() at EO.Internal.dptv.hczd() at EO.Internal.dpub.scdw() at EO.Internal.dpub..ctor(mwhd btr, HtmlToPdfOptions bts) at EO.Pdf.HtmlToPdfSession.gvjq(HtmlToPdfOptions aaw, WebView aax) at EO.Pdf.HtmlToPdfSession..ctor(HtmlToPdfOptions aas, WebView aat, HtmlToPdfSession aau, ResourceHandler aav) at EO.Pdf.HtmlToPdfSession.Create(HtmlToPdfOptions options, ResourceHandler resourceHandler) at EO.Pdf.HtmlToPdf.ehdk(HtmlToPdfOptions adz, frtk`2 aea, Boolean aeb) at EO.Pdf.HtmlToPdf.ehdj(HtmlToPdfOptions adx, frtk`2 ady) at EO.Pdf.HtmlToPdf.ConvertUrl(String url, PdfDocument doc, HtmlToPdfOptions options) at EO.Pdf.HtmlToPdf.ConvertUrl(String url, PdfDocument doc)

`InnerException: Failed on command 4: at System.Environment.GetStackTrace`: 9 times

"The request was canceled": 2times

"Operation timed out while waiting the page to be loaded": 1 time



Based on the above observation, we have a few questions:

1. Should the task count not decrease upon exception?
2. Can you expose a public property for the current task count in later EO versions?
3. What does the Engine crash mean?
4. What would be a suggestion to help us mitigate this error?

Thanks!

eo_support
Posted: Tuesday, June 3, 2025 10:54:20 AM
Rank: Administration
Groups: Administration

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

Internally our HTML to PDF converters runs a pool of browser engines to load/render the HTML file. "Engine crash" means one of the browser engine has crashed. Our converter is designed to be able to recover from such crash by recreating the engine. However you might have run into a case where there is something in your HTML that triggers a bug inside the browser engine so even if it tries to recover it still fails. This could ultimately leads to the converter exhuasting all available engines in the pool thus gives you the "Can not create additional conversion task" error.

We did recently fix an issue that could trigger browser engine crash and we expect the new build with the fix to be posted later this week. So I would recommend you to wait for that build and then switch to it. If you continue to see the problem with the new build, please collect both crash log and runtime log and send it to us:

https://www.essentialobjects.com/doc/common/crash_report.html
https://www.essentialobjects.com/doc/common/collect_logs.html

The crash log helps us to locate where the engine crashed. The runtime log might provide additional information on how it got to that point. After we have the logs we will look into it and see what we can find.

Thanks!
lucianchen
Posted: Tuesday, June 3, 2025 10:57:37 AM
Rank: Newbie
Groups: Member

Joined: 6/3/2025
Posts: 4
Thanks for the prompt reply! We'll keep an eye on the new version and try it out, and reach out if we still see the issue.
Also do we know if the new version will also fix the concurrent task count issue?
Meaning if we encounter the crash or other exceptions, is there a way to free the thread and put it back to the poo to avoid exhausting?
eo_support
Posted: Tuesday, June 3, 2025 2:08:02 PM
Rank: Administration
Groups: Administration

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

We don't know that for sure yet. That's why if you continue to see the problem, we will need the logs in order to investigate further. You do not need to do anything to free the thread and put it back to the pool. The library supposes to do that automatically. That would be another issue that we may need to investigate if we have a way to reproduce it here once the new build is out.

Thanks!
lucianchen
Posted: Wednesday, June 4, 2025 9:36:22 AM
Rank: Newbie
Groups: Member

Joined: 6/3/2025
Posts: 4
Thanks for the update!
We will collect the logs and upload after we tried with the new 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.