oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.47k stars 2.78k forks source link

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

Open victormamede opened 9 months ago

victormamede commented 9 months ago

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?

VigilioYonatan commented 9 months ago

Any update?

antongolub commented 7 months ago

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

askareija commented 6 months ago

same issue for bun 1.1.7

nektro commented 4 months ago

Is this still affecting you? It appears to work for me in Bun 1.1.20

nedsalk commented 2 weeks ago

@nektro we are experiencing the same issue in https://github.com/FuelLabs/fuels-ts/issues/3359. I have written steps to reproducing it there. Can you please take a look?