puppeteer: [Bug]: Browser.close() doesn't close Chromium if there are open pages

Bug description

Steps to reproduce the problem (Windows only):

  1. Launch browser in headless mode with options --in-process-gpu and --use-gl=swiftshader.
  2. Open a new page and go to some URL.
  3. browser.close() - hangs and doesn’t exit.

It works as expected when headless is false or above options are used alone (not together) or using Linux.

Workaround: close all pages before call to browser.close().

Puppeteer version

13.1.1

Node.js version

17

npm version

8.3.1

What operating system are you seeing the problem on?

Windows

Relevant log output

No response

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 18

Commits related to this issue

Most upvoted comments

Hi , may try to close all the pages first before browser.close()

        const pages = await browser.pages();
        for (let i = 0; i < pages.length; i++) {
          await pages[i].close();
        }
          await browser.close();

I could not get Puppeteer Browser to close even after trying to close its pages first. The only thing I got to work was to kill the child process:

const childProcess = browser.process()
if (childProcess) {
  childProcess.kill(9)
}

We’re marking this issue as unconfirmed because it has not had recent activity and we weren’t able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.

Same issue here. await browser.close() got stuck if it’s in headless mode, and with --single-process option.

Same. No issues after removing the argument. Really strange behavior for puppeteer and most importantly for its team who wouldn’t respond for months to an incredibly confusing bug.

Same issue here. await browser.close() got stuck if it’s in headless mode, and with --single-process option.

I could not get Puppeteer Browser to close even after trying to close its pages first. The only thing I got to work was to kill the child process:

const childProcess = browser.process()
if (childProcess) {
  childProcess.kill(9)
}

I had the same issue, my endpoint return timeout after 30 sec but continue working on the background. I put a console.log before and after browse.close() and have more than 1 minute of difference between them.

I tried to do page.close() but not changes. Finally, killing the child process work for me.

Why its not fixed yet?

Any updates on this ?