Skip to content

Conversation

@inigohidalgo
Copy link

@inigohidalgo inigohidalgo commented Apr 29, 2025

Hi all,

First of all: feel free to discard or modify this PR if unwelcome.

I am getting constant ConnectionReset errors on photos_request

  File "/Users/inigo/Programming/repos/public/icloud_photos_downloader/src/pyicloud_ipd/services/photos.py", line 412, in photos
    request = self.photos_request(offset)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inigo/Programming/repos/public/icloud_photos_downloader/src/pyicloud_ipd/services/photos.py", line 392, in photos_request
    return self.service.session.post(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inigo/Programming/repos/public/icloud_photos_downloader/.venv/lib/python3.12/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inigo/Programming/repos/public/icloud_photos_downloader/src/pyicloud_ipd/session.py", line 67, in request
    response = super().request(method, url, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inigo/Programming/repos/public/icloud_photos_downloader/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inigo/Programming/repos/public/icloud_photos_downloader/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inigo/Programming/repos/public/icloud_photos_downloader/.venv/lib/python3.12/site-packages/requests/adapters.py", line 682, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

but the failure is not caught by the except. Adding this correctly solves the issue on my end, one retry is sufficient for the error.

@AndreyNikiforov
Copy link
Collaborator

What is the root cause of the connection reset errors in your case? Was it because of the idle connection or overload 9or anything else)? If indeed overload, then waiting before retrying may be a good option.

@inigohidalgo
Copy link
Author

inigohidalgo commented May 2, 2025

@AndreyNikiforov I couldn't see any more info beyond the traceback I shared. But I can confirm that adding the change I am posting I managed to download my whole icloud photos library without any issues. I never had to do more than a single retry for any single file.

@AndreyNikiforov
Copy link
Collaborator

@inigohidalgo update changelog, pls

Copy link
Collaborator

@AndreyNikiforov AndreyNikiforov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update changelog, please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants