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: Clean up tmp profile dirs when browser is closed #8580

Merged
merged 3 commits into from Jun 27, 2022
Merged

fix: Clean up tmp profile dirs when browser is closed #8580

merged 3 commits into from Jun 27, 2022

Conversation

pablomatiasgomez
Copy link
Contributor

@pablomatiasgomez pablomatiasgomez commented Jun 25, 2022

What kind of change does this PR introduce?

Bugfix: Puppeteer is not deleting tmp profiles after browser is closed.

Did you add tests for your changes?

Yes, I actually first created the test to verify that it was actually broken the way I thought.

If relevant, did you update the documentation?

No, this is a small bugfix, but let me know if I should update anything.

Summary

Puppeteer has a feature in which if you don't specify a user data dir (--user-data-dir) it automatically creates one in a tmp folder, and then it's deleted when the browser is closed.
It seems that this feature got broken here, as it is now setting isTempUserDataDir to false in any case.

In my particular case, I instantiate Puppeteer multiple times, leading to an infinite number of dirs in the /tmp folder which were only deleted when I restarted the node.

ls -l /tmp/puppeteer_dev_chrome_profile-*  | wc -l
344

Does this PR introduce a breaking change?

No. (unless for any reason somebody is expecting for tmp profiles to be kept)

@google-cla
Copy link

google-cla bot commented Jun 25, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@pablomatiasgomez pablomatiasgomez marked this pull request as ready for review June 25, 2022 22:17
@OrKoN
Copy link
Collaborator

OrKoN commented Jun 26, 2022

Thanks for fixing this and for the test! I think it looks good and it only needs to skip this test on Firefox like the other tests.

@pablomatiasgomez
Copy link
Contributor Author

@OrKoN thanks for reviewing! I just changed the test to to be chrome only. Let me know if it looks good

@jrandolf jrandolf self-requested a review June 27, 2022 05:40
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

3 participants