beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.87k stars 1.82k forks source link

Importing with chroma plugin failes after some albums #1850

Closed parapente closed 8 years ago

parapente commented 8 years ago

The error message I get is the following:

Traceback (most recent call last):
  File "/usr/bin/beet", line 9, in <module>
    load_entry_point('beets==1.3.16', 'console_scripts', 'beet')()
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/ui/__init__.py", line 1207, in main
    _raw_main(args)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/ui/__init__.py", line 1197, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/ui/commands.py", line 947, in import_func
    import_files(lib, paths, query)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/ui/commands.py", line 924, in import_files
    session.run()
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/importer.py", line 318, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/util/pipeline.py", line 302, in run
    out = self.coro.send(msg)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/util/pipeline.py", line 184, in coro
    func(*(args + (task,)))
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/importer.py", line 1247, in lookup_candidates
    plugins.send('import_task_start', session=session, task=task)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/plugins.py", line 459, in send
    result = handler(**arguments)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beets/plugins.py", line 124, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beetsplug/chroma.py", line 144, in fingerprint_task
    return fingerprint_task(self._log, task, session)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beetsplug/chroma.py", line 213, in fingerprint_task
    acoustid_match(log, item.path)
  File "/usr/lib64/python2.7/site-packages/beets-1.3.16-py2.7.egg/beetsplug/chroma.py", line 66, in acoustid_match
    duration, fp = acoustid.fingerprint_file(util.syspath(path))
  File "/usr/lib64/python2.7/site-packages/acoustid.py", line 321, in fingerprint_file
    return _fingerprint_file_audioread(path, maxlength)
  File "/usr/lib64/python2.7/site-packages/acoustid.py", line 262, in _fingerprint_file_audioread
    with audioread.audio_open(path) as f:
  File "/usr/lib64/python2.7/site-packages/audioread/__init__.py", line 83, in audio_open
    if _ca_available():
  File "/usr/lib64/python2.7/site-packages/audioread/__init__.py", line 57, in _ca_available
    lib = ctypes.util.find_library('AudioToolbox')
  File "/usr/lib64/python2.7/ctypes/util.py", line 242, in find_library
    return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name))
  File "/usr/lib64/python2.7/ctypes/util.py", line 231, in _findSoname_ldconfig
    f = os.popen('/sbin/ldconfig -p 2>/dev/null')
OSError: [Errno 24] Too many open files

I'm running beets-1.3.16 with the following command:

beet import Music

jackwilsdon commented 8 years ago

Could you provide the output of ulimit -a? It looks like we're hitting the open file limit for some reason.

parapente commented 8 years ago

$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 23776 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 1300 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited

parapente commented 8 years ago

I don't really believe the limit is reached while scanning the music collection. It looks like some files aren't closed and that causes beet to reach the limit.

sampsyo commented 8 years ago

Since you mentioned that you have chroma enabled, it's likely that this issue in audioread is to blame: https://github.com/beetbox/audioread/issues/28 https://github.com/beetbox/audioread/issues/29

Fortunately, I just pushed a fix for it yesterday. Can you please try with the latest version of audioread (2.1.2)?

parapente commented 8 years ago

Indeed, updating audioread to 2.1.2 fixed this issue. Thanks!

sampsyo commented 8 years ago

Fantastic!

simonmcnair commented 1 year ago

Sending event: import_task_choice Traceback (most recent call last): File "/usr/local/bin/beet", line 8, in File "/usr/local/lib/python3.9/dist-packages/beets/ui/init.py", line 1285, in main File "/usr/local/lib/python3.9/dist-packages/beets/ui/init.py", line 1272, in _raw_main File "/usr/local/lib/python3.9/dist-packages/beets/ui/commands.py", line 973, in import_func File "/usr/local/lib/python3.9/dist-packages/beets/ui/commands.py", line 943, in import_files File "/usr/local/lib/python3.9/dist-packages/beets/importer.py", line 340, in run File "/usr/local/lib/python3.9/dist-packages/beets/util/pipeline.py", line 446, in run_parallel File "/usr/local/lib/python3.9/dist-packages/beets/util/pipeline.py", line 311, in run File "/usr/local/lib/python3.9/dist-packages/beets/util/pipeline.py", line 193, in coro File "/usr/local/lib/python3.9/dist-packages/beets/importer.py", line 1369, in lookup_candidates File "/usr/local/lib/python3.9/dist-packages/beets/plugins.py", line 488, in send File "/usr/local/lib/python3.9/dist-packages/beets/plugins.py", line 145, in wrapper File "/usr/local/lib/python3.9/dist-packages/beetsplug/chroma.py", line 180, in fingerprint_task File "/usr/local/lib/python3.9/dist-packages/beetsplug/chroma.py", line 249, in fingerprint_task File "/usr/local/lib/python3.9/dist-packages/beetsplug/chroma.py", line 89, in acoustid_match File "/usr/local/lib/python3.9/dist-packages/acoustid.py", line 340, in fingerprint_file File "/usr/local/lib/python3.9/dist-packages/acoustid.py", line 280, in _fingerprint_file_audioread File "/usr/local/lib/python3.9/dist-packages/audioread/init.py", line 127, in audio_open File "/usr/local/lib/python3.9/dist-packages/audioread/rawread.py", line 59, in init OSError: [Errno 24] Too many open files: b'/srv/15- (21533068).flac'

root@local:/srv/Various# pip install audioread Requirement already satisfied: audioread in /usr/local/lib/python3.9/dist-packages (3.0.0)