Error while submitting data to Solr

After running:

docker compose exec indexer python -m sir reindex

I keep getting the following error:

2025-12-02 15:51:34,335: Checking whether the versions of the Solr cores are supported
2025-12-02 15:51:34,388: Importing annotation...
2025-12-02 15:53:12,605: Successfully imported annotation!
2025-12-02 15:53:12,759: Importing area...
2025-12-02 15:53:50,017: Successfully imported area!
2025-12-02 15:53:50,340: Importing artist...
2025-12-02 15:58:20,943: Successfully imported artist!
2025-12-02 15:58:20,965: Importing cdstub...
2025-12-02 15:58:46,516: Successfully imported cdstub!
2025-12-02 15:58:46,538: Importing editor...
2025-12-02 15:58:46,570: Successfully imported editor!
2025-12-02 15:58:46,582: Importing event...
2025-12-02 15:59:41,249: Successfully imported event!
2025-12-02 15:59:41,287: Importing instrument...
2025-12-02 15:59:42,354: Successfully imported instrument!
2025-12-02 15:59:42,389: Importing label...
2025-12-02 16:00:17,478: Successfully imported label!
2025-12-02 16:00:29,498: Importing place...
2025-12-02 16:00:49,021: Successfully imported place!
2025-12-02 16:00:49,040: Importing recording...
2025-12-02 16:16:27,983: Error while submitting data to Solr:
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
  File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 516, in getresponse
    httplib_response = super().getresponse()
  File "/usr/local/lib/python3.13/site-packages/sentry_sdk/integrations/stdlib.py", line 131, in getresponse
    rv = real_getresponse(self, *args, **kwargs)
  File "/usr/local/lib/python3.13/http/client.py", line 1430, in getresponse
    response.begin()
    ~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/socket.py", line 719, in readinto
    return self._sock.recv_into(b)
           ~~~~~~~~~~~~~~~~~~~~^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
        method=request.method,
    ...<9 lines>...
        chunked=chunked,
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 841, in urlopen
    retries = retries.increment(
        method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
        conn,
    ...<10 lines>...
        **response_kw,
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 367, in _raise_timeout
    raise ReadTimeoutError(
        self, url, f"Read timed out. (read timeout={timeout_value})"
    ) from err
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='search', port=8983): Read timed out. (read timeout=60)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/pysolr.py", line 414, in _send_request
    resp = requests_method(
        url,
    ...<4 lines>...
        auth=self.auth,
    )
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/requests/adapters.py", line 713, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='search', port=8983): Read timed out. (read timeout=60)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/code/sir/indexing.py", line 338, in send_data_to_solr
    solr_connection.add(data)
    ~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pysolr.py", line 1083, in add
    return self._update(
           ~~~~~~~~~~~~^
        m,
        ^^
    ...<8 lines>...
        min_rf=min_rf,
        ^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/pysolr.py", line 572, in _update
    return self._send_request(
           ~~~~~~~~~~~~~~~~~~^
        "post",
        ^^^^^^^
    ...<2 lines>...
        {"Content-type": "application/json; charset=utf-8"},
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/pysolr.py", line 425, in _send_request
    raise SolrError(error_message % (url, err))
pysolr.SolrError: Connection to server 'http://search:8983/solr/recording/update/' timed out: HTTPConnectionPool(host='search', port=8983): Read timed out. (read timeout=60)
2025-12-02 16:16:31,143: Error while submitting data to Solr:
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
  File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 516, in getresponse
    httplib_response = super().getresponse()
  File "/usr/local/lib/python3.13/site-packages/sentry_sdk/integrations/stdlib.py", line 131, in getresponse
    rv = real_getresponse(self, *args, **kwargs)
  File "/usr/local/lib/python3.13/http/client.py", line 1430, in getresponse
    response.begin()
    ~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^

I have about 128GB RAM, and using Ryzen 9 5950X so my system should be capable of handling this, my memory-settings is as follows:

# Description: Customize memory settings

services:
  db:
    shm_size: '4g'
    command: postgres -c "shared_buffers=24GB" -c "work_mem=128MB" -c "maintenance_work_mem=4GB" -c "effective_cache_size=64GB" -c "shared_preload_libraries=pg_amqp.so"
    # command: postgres -c "shared_buffers=24GB" -c "shared_preload_libraries=pg_amqp.so"
  search:
    environment:
      - SOLR_HEAP=28g

So, what could be the problem here?

Hello, @olayemi , welcome to MusicBrainz!

I have been having a similar problem when running reindex on my MusicBrainz mirror server also.

You can read my observations at the topic, Sir reindex fails with ConnectionResetError(104, ‘Connection reset by peer’). I put more detailed notes in a bug report, ticket MBVM-105 Sir reindex fails with ConnectionResetError(104, ‘Connection reset by peer’)) and consequences.

I wrote up what I learned in the following proposed improvements to the musicbrainz-docker documentation: #328 Add “Connection errors during reindex” to TROUBLESHOOTING.md and # 329 Add “Docker settings” section to README.md.

So I suggest reading those notes. Please come back with follow-up questions. I will be glad to try to answer them from my experience.

It is interesting that you set SOLR_HEAP=28g and that was not enough. I was hoping that 10GB or 12GB would be enough.

Are you using the docker.desktop app? If so, what overall Memory Limit did you set for the app?

What OS are you using?

1 Like

Yeah @Jim_DeLaHunt I saw your write up, the thing though is, I am not using docker desktop, and all of the container has access to all the 128GB memory, I have been on this for days.

My main issue is re-indexing the recordings, if I run:

docker compose exec indexer python -m sir reindex --entity-type recording

I have the same issue.

In your ticket here: [MBVM-105] Sir reindex fails with ConnectionResetError(104, ‘Connection reset by peer’)) and consequences - MetaBrainz Tickets

I see you started having the issue with annotation and it went away after you adjusted the memory, in my case, I have tons of free memory.

There is also an option for pre-built indexes, that works for me, but I discovered tons of recordings are missing while using the API even when it is visible in the DB, so, I wanted to try this route

Thank you for the extra details. It looks like you are experiencing a different problem than I did.

I fixed the issue!

3 damn days on this!!!

The issue was a corruption somewhere, could be the indexer container, so, what I did is, I recreated the DB, using the following command:

docker compose stop
docker compose run --rm musicbrainz fetch-dump.sh indexed
admin/purge-message-queues
docker compose up -d search
docker compose exec search fetch-backup-archives
docker compose exec search load-backup-archives

docker compose run --rm musicbrainz recreatedb.sh
docker compose up -d

Here is a twist, even after doing this, I discovered I can’t use the indexed search for type recording, I invoked the index rebuild for just that and it worked this time:

docker compose exec indexer python -m sir reindex --entity-type recording