Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Kill browser process when 'taskkill' fails on Windows

Merged
merged 1 commit into from May 16, 2022

Conversation

szuend
Copy link
Collaborator

@szuend szuend commented May 16, 2022

What kind of change does this PR introduce?

bugfix

Did you add tests for your changes?

No, this PR affects windows only and affects how we shut down the browser process.

Summary

On windows, we use taskkill to kill the browser process. The reason is that we want to shutdown the whole process group, i.e. also kill all child processes spawned by the browser process. Calling taskkill can fail though, if its called by a user with not enough privileges, in that case we should fall back to using subprocess.kill.

As per Node.js documentation we also cleanup all the processes of a process group as long as we do not start the browser process in detached mode (which we do not do) once the main Node.js process dies.

Does this PR introduce a breaking change?

No

Other information

This might also fix issue #7922.

OrKoN
OrKoN approved these changes May 16, 2022
@OrKoN OrKoN enabled auto-merge (squash) May 16, 2022
@OrKoN OrKoN merged commit dccfadb into puppeteer:main May 16, 2022
10 checks passed
@szuend szuend deleted the kill-process-fresh branch May 20, 2022
This was referenced May 30, 2022
This was referenced May 30, 2022
jimmydief added a commit to jimmydief/puppeteer that referenced this issue Jun 6, 2022
jimmydief added a commit to jimmydief/puppeteer that referenced this issue Jun 6, 2022
jrandolf pushed a commit to jimmydief/puppeteer that referenced this issue Jun 7, 2022
jrandolf pushed a commit that referenced this issue Jun 7, 2022
Fixes #8476. Similar fix to #8352 which only covered Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants