Flayms / Markdown2Pdf

.NET library for converting markdown to PDF.
https://www.nuget.org/packages/Markdown2Pdf/
MIT License
5 stars 1 forks source link

Puppeteer has error #90

Open ABatenev opened 3 months ago

ABatenev commented 3 months ago

In 50% i have PuppeteerSharp.NavigationException: 'Timeout of 30000 ms exceeded' when call await converter.Convert()

PuppeteerSharp.NavigationException HResult=0x80131500 Message=Timeout of 30000 ms exceeded Source=PuppeteerSharp StackTrace: at PuppeteerSharp.Cdp.CdpFrame.d17.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Markdown2Pdf.Markdown2PdfConverter.<_GeneratePdfAsync>d__50.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Markdown2Pdf.Markdown2PdfConverter.<_ConvertInternal>d47.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Markdown2Pdf.Markdown2PdfConverter.<_Convert>d46.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Markdown2Pdf.Markdown2PdfConverter.d43.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

This exception was originally thrown at this call stack: [External Code]

Inner Exception 1: TimeoutException: Timeout of 30000 ms exceeded

Flayms commented 3 months ago

Interesting, is it related to a new version? ~And are you using very big markdown files? It might be Highlight.js taking too long, hitting the default timeouts from Puppeteer~ Edit: A timeout of 30 seconds is definitely too long

ABatenev commented 3 months ago

I use the same md file, but in half of the cases the timeout causes an error, in the other it does not. This happens even for a single-line md file. Floating bug, I can't figure out why it's happening

ABatenev commented 3 months ago

Perhaps I have found a solution to this problem. On my VM, Chrome.exe does not close after an error, causing subsequent runs without closing the process to return a timeout error. Maybe you should add browser.Process.Close(); in the catch block when chrome starts? https://github.com/hardkoded/puppeteer-sharp/issues/2393 image

Flayms commented 3 months ago

Using browser.Process.Close(); is keeping the Process stuck for me. In #90 I changed to await using for the browser and page. Can you check if this resolves the issue?