Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promises intermittently not resolved #286

Closed
laracee opened this issue Oct 11, 2020 · 1 comment · Fixed by #296
Closed

Promises intermittently not resolved #286

laracee opened this issue Oct 11, 2020 · 1 comment · Fixed by #296
Labels

Comments

@laracee
Copy link

laracee commented Oct 11, 2020

My Node.js application uses html-pdf-chrome to convert thousands of HTMLs to PDFs.

Intermittently (after several hours), the Promise.all() call in beforeNavigate() (https://github.com/westy92/html-pdf-chrome/blob/master/src/index.ts#L106-L110) does not resolve. As a result, my Node.js dependent that calls htmlPdf.create() also got stuck.

Due to the intermittence, I've split that into 3 separate await lines to insert console.debug() lines after each.

Based on those debugging statements, I've seen occurrences of either Runtime.enable() not resolving or Network.enable() not resolving.

Before I consider trying to handle this as a timeout problem (to potentially retry), I'm seeking for suggestions/ideas/help on how to debug this further.

I couldn't find past reports regarding such intermittent problem on GitHub or on SO.

The version of Node.js used is 12.16.3 on an AWS EC2 t2-medium instance.

The headless Chromium version is 706915 (installed as part of [email protected] but I don't use anything from puppeteer itself). It is running on the same host as Node.js. It is started just before the Node.js process is started and there's no code that restarts the Chromium process. Newer precompiled Chromium instances don't work on this AWS EC2 (Linux ip-xxx-xxx-xxx-xxx 4.9.85-38.58.amzn1.x86_64 #1 SMP Wed Mar 14 01:17:26 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux).

All the HTMLs are on the same host, too, passed on to htmlPdf.create() as file://name.html. The Node.js process + Chromium process + input files are all on the same host.

And, to avoid making the EC2 instance be too overloaded, the Node.js application throttles so that there are, at the most, 10 tabs the headless Chromium needs to convert at any particular time, using the technique involving Promise.race().

I haven't been able to come up with a small test program that reproduces the intermittent problem.

@westy92
Copy link
Owner

westy92 commented Mar 25, 2021

Possibly related: cyrus-and/chrome-remote-interface#304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants