bun icon indicating copy to clipboard operation
bun copied to clipboard

Puppeteer can't close the browser: "pid must be a positive integer"

Open victormamede opened this issue 1 year ago • 3 comments

What version of Bun is running?

1.0.26+c75e768a6

What platform is your computer?

Linux 6.7.3-arch1-1 x86_64 unknown

What steps can reproduce the bug?

launch puppeteer and try to close the instance

import puppeteer from "puppeteer";

const browser = await puppeteer.launch({
  headless: false,
});
const page = await browser.newPage();
await page.goto("https://bun.sh/");
await page.screenshot({ path: "example.png" });
await browser.close();

What is the expected behavior?

Instance closing correctly

What do you see instead?

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: RangeError: pid must be a positive integer

Additional information

My guess is that the browser instance isn't getting the browser PID, maybe because of some node API that puppeteer uses?

victormamede avatar Feb 08 '24 17:02 victormamede

Any update?

VigilioYonatan avatar Mar 01 '24 02:03 VigilioYonatan

process.kill(-pid) (negative pid) is a way to eliminate a group of (children, datached) processes.

antongolub avatar Apr 06 '24 18:04 antongolub

same issue for bun 1.1.7

askareija avatar May 10 '24 11:05 askareija