beets icon indicating copy to clipboard operation
beets copied to clipboard

urlopen error [Errno 12] Cannot allocate memory

Open juanra opened this issue 2 years ago • 0 comments

Problem

Running this command in verbose (-vv) mode:

$ beet -vv import /music

Led to this problem, and it is happening a lot:

Requesting MusicBrainz release 9d69611c-2d01-411f-9e09-225698d8ef3c
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1294, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1340, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1289, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1048, in _send_output
    self.send(msg)
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 986, in send
    self.connect()
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1459, in connect
    super().connect()
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 952, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 851, in create_connection
    raise exceptions[0]
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 836, in create_connection
    sock.connect(sa)
OSError: [Errno 12] Cannot allocate memory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/musicbrainzngs/musicbrainz.py", line 497, in _safe_read
    f = opener.open(req)
        ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 519, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 12] Cannot allocate memory>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/beets/autotag/mb.py", line 567, in album_for_id
    res = musicbrainzngs.get_release_by_id(albumid,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/musicbrainzngs/musicbrainz.py", line 879, in get_release_by_id
    return _do_mb_query("release", id, includes, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/musicbrainzngs/musicbrainz.py", line 728, in _do_mb_query
    return _mb_request(path, 'GET', auth_required, args=args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/musicbrainzngs/musicbrainz.py", line 417, in __call__
    return self.fun(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/musicbrainzngs/musicbrainz.py", line 690, in _mb_request
    resp = _safe_read(opener, req, body)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/musicbrainzngs/musicbrainz.py", line 525, in _safe_read
    raise NetworkError(cause=exc)
musicbrainzngs.musicbrainz.NetworkError: caused by: <urlopen error [Errno 12] Cannot allocate memory>

Error: MusicBrainz not reachable in get release by ID with query '9d69611c-2d01-411f-9e09-225698d8ef3c'

Setup

  • OS: MacOS Sonoma 14.3 (23D56)
  • Python version: 3.11
  • beets version: 1.6.0
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

plugins: chroma convert inline lyrics replaygain 

directory: /Volumes/libraries/music
library: ~/.config/beets/library.db

threaded: yes
per_disc_numbering: yes

item_fields:
    multidisc: 1 if disctotal > 1 else 0

# https://beets.readthedocs.io/en/stable/reference/pathformat.html
paths:
    default: $albumartist/$album%aunique{albumartist album, albumtype year label catalognum albumdisambig releasegroupdisambig,()}/%if{$multidisc,Disc $disc/}$track - $title
    singleton: $albumartist/$album%aunique{albumartist album, albumtype year label catalognum albumdisambig releasegroupdisambig,()}/%if{$multidisc,Disc $disc/}$track - $title
    comp: $albumartist/Compilations/$album%aunique{albumartist album, albumtype year label catalognum albumdisambig releasegroupdisambig,()}/%if{$multidisc,Disc $disc/}$track - $title
    albumtype_soundtrack: $albumartist/Soundtracks/$album%aunique{albumartist album, albumtype year label catalognum albumdisambig releasegroupdisambig,()}/%if{$multidisc,Disc $disc/}$track - $title
        
# https://beets.readthedocs.io/en/stable/reference/config.html#importer-options
import:
    write: yes
    copy: yes
    move: no
    resume: ask
    timid: no
    log: ~/.config/beets/beet.log

replace:
    '^\.': _
    '[\x00-\x1f]': _
    '[<>:"\?\*\|]': _
    '[\xF8]': o
    '\.$': _
    '\s+$': ''

# https://beets.readthedocs.io/en/stable/plugins/convert.html
convert:
    auto: yes
    copy_album_art: yes
    embed: yes
    ffmpeg: /opt/homebrew/bin/ffmpeg
    max_bitrate: 320
    no_convert: format:AAC
    format: aac

# https://beets.readthedocs.io/en/stable/plugins/replaygain.html
replaygain:
    auto: yes
    backend: ffmpeg

# https://beets.readthedocs.io/en/stable/plugins/chroma.html
chroma:
    auto: yes

# https://beets.readthedocs.io/en/stable/plugins/lyrics.html
lyrics:
    auto: yes
    google_API_key: SUUUUUPPPERRRRRKEEYYY    
    google_engine_ID: SUUUUUPPPERRRRRKEEYYY:SUUUUUPPPERRRRRKEEYYY

juanra avatar Feb 04 '24 00:02 juanra