spotify-downloader: OSError: Too Many Files, when downloading a bigger playlist

System OS

MacOS

Python Version

3.11 (CPython)

Install Source

pip / PyPi

Install version / commit hash

v4.2.4

Expected Behavior vs Actual Behavior

When downloading a larger playlist after about 50-70 tracks have been downloaded the terminal throws an error saying Too many open files, and all subsequent tracks do not get downloaded and it starts saying audio provider error. Screenshot 2023-12-09 at 2 45 31 PM

Steps to reproduce - Ensure to include actual links!

Simple spotdl command on any large playlist should show this issues

Traceback

OSError: [Errno 24] Too many open files
OSError: [Errno 24] Too many open files
AudioProviderError: YT-DLP download error - https://music.youtube.com/watch?v=ZiZWzVfeWVg
AudioProviderError: YT-DLP download error - https://music.youtube.com/watch?v=Aduc9vE3Mog
AudioProviderError: YT-DLP download error - https://music.youtube.com/watch?v=_GfaWmDDpNM
AudioProviderError: YT-DLP download error - https://music.youtube.com/watch?v=XHA8OP2IbXU

Other details

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 20 (2 by maintainers)

Most upvoted comments

looking through the source quickly it looks like the project follows the pythonic with in a few different places but doesn’t explicitly call os.close which I think is the source of the issue ref: https://github.com/spotDL/spotify-downloader/blob/f90cfb3f5ab1b15e73d0393d531908d4ac789e7d/spotdl/console/save.py#L87-88

this tutorial solved temporarily the issue: https://gist.github.com/skylock/0117ec637d468f91260927b43b816eda

but closing the file after saving it should solve this issue (file stay open in RAM even after song finished)

try running ulimit -S 4096

I will investigate this more thoroughly whenever I get some time

for those on macos, use this to bypass the open file limit

https://gist.github.com/tutozz/cc234c960d8e778c4f5c84b28a7b1854

I have the same issue on Ubuntu 22.04

Still have this issue on Ubuntu 23.10.