fakebrowser icon indicating copy to clipboard operation
fakebrowser copied to clipboard

Modify shutdown order

Open davecardwell opened this issue 3 years ago • 0 comments

puppeteer v14.1.1 on macOS 12.4 M1 Pro

Saw the error below when calling fakeBrowser.shutdown(), caused by the puppeteer’s BrowserRunner code trying to kill the process group when FakeBrowser had already killed all its PIDs.

This commit changes the order to call browser.close() before killing the process tree. You may also choose to simply remove the process killing code since puppeteer already does that.

Unhandled Rejection at: Promise {
  <rejected> Error: Puppeteer was unable to kill the process which ran the browser binary.
  This means that, on future Puppeteer launches, Puppeteer might not be able to launch the browser.
  Please check your open processes and ensure that the browser processes that Puppeteer launched have been killed.
  If you think this is a bug, please report it on the Puppeteer issue tracker.
  Error cause: Error: kill EPERM
      at process.kill (node:internal/process/per_thread:220:13)
      at BrowserRunner.kill (<removed>/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:196:29)
      at <removed>/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:168:22
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at BrowserRunner.kill (<removed>/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:200:23)
      at <removed>/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:168:22
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
}

davecardwell avatar May 26 '22 00:05 davecardwell