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

[utils] Fix race condition in make_dir #6089

Merged
merged 2 commits into from
Feb 17, 2023
Merged

[utils] Fix race condition in make_dir #6089

merged 2 commits into from
Feb 17, 2023

Conversation

aionescu
Copy link
Contributor

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

Call os.makedirs with exist_ok=True, rather than performing a separate check with os.path.exists.

This fixes a race condition that can occur when spawning multiple yt-dlp processes with the same output directory, where one of the processes crashes with Unable to create directory [Errno 17]: File exists, due to the interleaving of calls to os.path.exists and os.makedirs.

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

@pukkandan pukkandan added the bug Bug that is not site-specific label Jan 25, 2023
@pukkandan pukkandan merged commit b25d6cb into yt-dlp:master Feb 17, 2023
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is not site-specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants