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

Timeouts with 1.12.2 on cloud function #3944

Closed
neelance opened this issue Feb 7, 2019 · 16 comments
Closed

Timeouts with 1.12.2 on cloud function #3944

neelance opened this issue Feb 7, 2019 · 16 comments

Comments

@neelance
Copy link

neelance commented Feb 7, 2019

  • Puppeteer version: 1.12.2
  • Platform / OS version: Firebase Cloud Function
  • Node.js version: 8

We are using Puppeteer on a Firebase Cloud Function to automatically render PDFs. I upgraded to Puppeteer 1.12.2 and the cloud function started to run into 60s timeouts as soon as there are multiple concurrent requests. Some additional logging shows that some invocations are even hanging at the very beginning of the function. With 1.11.0 everything is fine. I know that this is not much information for reproducing this issue, but I wanted to make you aware anyways. We're staying with the older version for now. Feel free to close.

@aslushnikov
Copy link
Contributor

@neelance thanks for letting us know. Any chance you can share more information? Which calls timeout for you? Do you use the bundled chromium instance or a custom one? If custom, than which version?

@neelance
Copy link
Author

neelance commented Feb 7, 2019

I'm using the bundled chromium with --no-sandbox. It does not seem to be a specific call. I put a log statement at the beginning of the function and sometimes the only logs I got were Function execution started and Function execution took 60002 ms, finished with status: 'timeout', which suggests that the function didn't even start to run. The function was triggered by a change to the Firebase Realtime Database. It's all quite strange and I don't really now how to narrow it down.

@adampasz
Copy link

adampasz commented Feb 8, 2019

I am having issues with timeouts with Node 8 and 1.12.2 as well.
Sorry, I don't have more info. I haven't had time to debug it deeply.
I rolled back to 1.10.0, which does not seem to get stuck.

@cameronlowry
Copy link

I'm also getting timeouts when upgrading from 1.11.0 to 1.12.2

@coder-pm
Copy link

Look like issue after bugfix: #609 - page.waitForSelector doesn't work on baidu.com.

After few loads of same page I got timeouts on page.waitForSelector. Also my puppeteer instance freezes on page.click (but only after that few loads). Timeout exception stack trace:

TimeoutError: waiting for selector ".selector" failed: timeout 30000ms exceeded, TimeoutError: waiting for selector ".selector" failed: timeout 30000ms exceeded
    at new WaitTask (project_dir\node_modules\puppeteer\lib\DOMWorld.js:554:28)
    at DOMWorld._waitForSelectorOrXPath (project_dir\node_modules\puppeteer\lib\DOMWorld.js:483:22)
    at DOMWorld.waitForSelector (project_dir\node_modules\puppeteer\lib\DOMWorld.js:437:17)
    at Frame.waitForSelector (project_dir\node_modules\puppeteer\lib\FrameManager.js:606:47)
    at Frame.<anonymous> (project_dir\node_modules\puppeteer\lib\helper.js:109:23)
    at Page.waitForSelector (project_dir\node_modules\puppeteer\lib\Page.js:1079:29)
    at Object.visit (project_dir\dist\scraping\runner.js:115:43)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

Same code works perfectly fine on v1.11.0

@aslushnikov
Copy link
Contributor

Thanks @coder-pm; this is a dupe of #4011

@neelance
Copy link
Author

@aslushnikov Unfortunately I'm still seeing this with 1.15.0.

@coder-pm
Copy link

coder-pm commented May 16, 2019

That's right, but this time it is not freezing, just throwing an timeout. In my case I was using page.$('.selector') to obtain handler and than click on it if it was not null. After first few loads it was ok, but later page.$('.selector') was returning handle and click threw a timeout (element was not in DOM)

@neelance
Copy link
Author

Some additional logging shows that some invocations are even hanging at the very beginning of the function.

This still applies.

@barbolo
Copy link

barbolo commented Aug 5, 2019

I'm having the same timeout problem in GCF.

I've written logs into every step inside and outside handler (global variables initialisation, steps inside function handler, ...) and when a timeout in GCF occurs, nothing shows up in log related to the execution id that timeouts.

I think it may have something to do with restoring the state of the function container between calls, but I'm not sure.

@aslushnikov I think you should reopen this issue

image

@jbdutton
Copy link

I've experienced this same issue in GCF on every version from 1.12 - 1.19, as @barbolo described, all using the bundled version of Chromium. 1.11 is the latest version that still works but it currently has a high severity vulnerability according to npm audit and isn't suitable for continued use.

@neelance
Copy link
Author

I just managed to avoid the issue by not reusing the browser across function invocations. I was keeping the browser as a global variable and only initialized it once. I used try { ... } finally { page.close() } to clean up at the end of every invocation. Now I'm using try { ... } finally { browser.close() } instead.

@remideneleaodocs
Copy link

I had the same systematic timeout problem in GCF after updating from puppeteer 1.11 to 1.17 last summer so reverted back:
image

I'm also reusing the browser instance between invocations so may try by closing/starting a new one each time to test. But seeing it takes between 2 and 14s to start the browser (in a 2GB GCF) it will again slow down an already very slow function (generating PDF):

image

@neelance
Copy link
Author

@aslushnikov Can we please reopen this issue, since it is not solved yet?

@brianpetro
Copy link

Not sure if it was the same issue (goto wasn't loading the page), but, upgrading to 2.0.0 seems to have fixed things for me.

@ggirou
Copy link

ggirou commented Jan 25, 2020

I switched to chrome-aws-lambda and it fixed timeouts for me.
See #3120 (comment)

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

No branches or pull requests

10 participants