0

I am running puppeteer on a Linux VM, which does not have a display; however, I am using xvfb to remedy that.

For some background: The overall goal of this program is to navigate to a page and authenticate using puppeteer. From there, I audit several webpages using Lighthouse. I have been running this script for several weeks in headless no issues. I've recently found that the performance metrics of the headless Lighthouse runs far better than reality by running manual tests on my local machine through chrome developer tools. If it's relevant, I specifically noticed a huge gap in the number of recorded DOM nodes. Long story short, I now need to run this script in headful mode.

After installing and implementing xvfb in my code, I have been able to start a display within my script without hitting any errors. I used the answer from this question as reference: Running Puppeteer with xfvb headless : false

With all of that out of the way, onto the actual issue: this script, including the xvfb implementation, still runs flawlessly in headless mode with absolutely no timeouts despite repeated runs. When I try running it in headful mode, I consistently timeout on the puppeteer launch, even when I tried extending the timeout to 5 minutes. I've tried an absurd amount of launch-option combinations to no avail. Any and all help would be so greatly appreciated, even if it means significantly altering my approach to the problem. Thank you!

  • Can you increase the amount of memory on your Linux machine? I'd bet that it's a memory related issue when you run in headed mode – Raphael Rafatpanah Jun 10 '22 at 00:51
  • @RaphaelRafatpanah Do you think that could still be the case despite my change in timeout to 5 min? This is fairly new territory for me, so I'm not familiar with how much of a difference there might be. Would you happen to have a general idea of the amount of memory required for headless vs headful? Or might that be tied to the number DOM nodes? I can increase the memory, but would potentially want more of a concrete understanding before making that change. – Jack Lorenzo Kurtz Jun 10 '22 at 01:17
  • There's no concrete number, but I remember getting weird behavior including timeouts when running out of memory, and increasing memory fixed the issue for me. Try it with an ephemeral instance (e.g. Digitalocean) and see if it works! – Raphael Rafatpanah Jun 10 '22 at 01:43
  • If you have 1GB currently, try 2GB and if that doesn't work, try 4GB. It won't cost much since you'll run only a few tests. Also, the memory needed will likely depend on your application. – Raphael Rafatpanah Jun 10 '22 at 01:44
  • Hi @JackLorenzoKurtz, were you able to make any progress here? I’m running into the same issue, and wondering if increasing memory helped in your case. – Shane Cavaliere Sep 01 '22 at 20:58

0 Answers0