beetbox / audioread

cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python
MIT License
491 stars 108 forks source link

"Cannot allocate memory" during chromaprint fingerprinting #40

Open linkdaniel opened 7 years ago

linkdaniel commented 7 years ago

Hi,

In the middle of fingerprinting ~1,700 songs, I got the following error. I had run "sudo -H pip install -U audioread" before, so the package should have been up to date.

Traceback (most recent call last):
  File "/usr/bin/beet", line 9, in <module>
    load_entry_point('beets==1.3.8', 'console_scripts', 'beet')()
  File "/usr/share/beets/beets/ui/__init__.py", line 964, in main
    _raw_main(args)
  File "/usr/share/beets/beets/ui/__init__.py", line 954, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/share/beets/beetsplug/chroma.py", line 181, in fingerprint_cmd_func
    write=config['import']['write'].get(bool))
  File "/usr/share/beets/beetsplug/chroma.py", line 287, in fingerprint_item
    _, fp = acoustid.fingerprint_file(item.path)
  File "/usr/local/lib/python2.7/dist-packages/acoustid.py", line 321, in fingerprint_file
    return _fingerprint_file_audioread(path, maxlength)
  File "/usr/local/lib/python2.7/dist-packages/acoustid.py", line 262, in _fingerprint_file_audioread
    with audioread.audio_open(path) as f:
  File "/usr/local/lib/python2.7/dist-packages/audioread/__init__.py", line 83, in audio_open
    if _ca_available():
  File "/usr/local/lib/python2.7/dist-packages/audioread/__init__.py", line 57, in _ca_available
    lib = ctypes.util.find_library('AudioToolbox')
  File "/usr/lib/python2.7/ctypes/util.py", line 248, in find_library
    return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name))
  File "/usr/lib/python2.7/ctypes/util.py", line 237, in _findSoname_ldconfig
    f = os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null')
OSError: [Errno 12] Cannot allocate memory
sampsyo commented 7 years ago

Thanks! We should probably catch OSError in that check.

sampsyo commented 7 years ago

Oh, also: can you please include details about your system setup (OS, Python version, etc.)?

yakir12 commented 7 years ago

I have the same problem:

Traceback (most recent call last):
  File "/usr/local/bin/beet", line 11, in <module>
    load_entry_point('beets==1.4.5', 'console_scripts', 'beet')()
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/__init__.py", line 1256, in main
    _raw_main(args)
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/__init__.py", line 1243, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/commands.py", line 934, in import_func
    import_files(lib, paths, query)
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/commands.py", line 911, in import_files
    session.run()
  File "/usr/local/lib/python2.7/dist-packages/beets/importer.py", line 325, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/local/lib/python2.7/dist-packages/beets/util/pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/local/lib/python2.7/dist-packages/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "/usr/local/lib/python2.7/dist-packages/beets/util/pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "/usr/local/lib/python2.7/dist-packages/beets/importer.py", line 1289, in lookup_candidates
    plugins.send('import_task_start', session=session, task=task)
  File "/usr/local/lib/python2.7/dist-packages/beets/plugins.py", line 452, in send
    result = handler(**arguments)
  File "/usr/local/lib/python2.7/dist-packages/beets/plugins.py", line 124, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/chroma.py", line 143, in fingerprint_task
    return fingerprint_task(self._log, task, session)
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/chroma.py", line 212, in fingerprint_task
    acoustid_match(log, item.path)
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/chroma.py", line 65, in acoustid_match
    duration, fp = acoustid.fingerprint_file(util.syspath(path))
  File "/usr/local/lib/python2.7/dist-packages/acoustid.py", line 321, in fingerprint_file
    return _fingerprint_file_audioread(path, maxlength)
  File "/usr/local/lib/python2.7/dist-packages/acoustid.py", line 262, in _fingerprint_file_audioread
    with audioread.audio_open(path) as f:
  File "/usr/local/lib/python2.7/dist-packages/audioread/__init__.py", line 85, in audio_open
    if _ca_available():
  File "/usr/local/lib/python2.7/dist-packages/audioread/__init__.py", line 59, in _ca_available
    lib = ctypes.util.find_library('AudioToolbox')
  File "/usr/lib/python2.7/ctypes/util.py", line 248, in find_library
    return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name))
  File "/usr/lib/python2.7/ctypes/util.py", line 237, in _findSoname_ldconfig
    f = os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null')
OSError: [Errno 12] Cannot allocate memory

I'm on:

Linux version 4.4.0-83-generic (buildd@lgw01-29) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017

and beets is:

beets version 1.4.5
Python version 2.7.12
plugins: acousticbrainz, chroma, discogs, fromfilename, info, lastgenre, mbsync, play, web