boredazfcuk / docker-icloudpd

An Alpine Linux container for the iCloud Photos Downloader command line utility
1.58k stars 149 forks source link

Always waits for next sync when some network connection error occurs #603

Closed DominicWoozy closed 2 days ago

DominicWoozy commented 3 days ago
24-07-04 19:25:48 INFO     Downloaded /home/user/iCloud/2024/04/04/IMG_6531.HEIC
2024-07-04 19:25:48 DEBUG    Downloading /home/user/iCloud/2024/04/04/IMG_6531_HEVC.MOV...
2024-07-04 19:25:48 INFO     Downloaded /home/user/iCloud/2024/04/04/IMG_6531_HEVC.MOV
2024-07-04 19:25:58 ERROR    Failed to download new files
2024-07-04 19:25:58 ERROR     - Can you log into icloud.com without receiving pop-up notifications?
2024-07-04 19:25:58 ERROR    Error debugging info:
2024-07-04 19:25:58 ERROR    Traceback (most recent call last):
  File "urllib3/connection.py", line 174, in _new_conn
  File "urllib3/util/connection.py", line 72, in create_connection
  File "socket.py", line 964, in getaddrinfo
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 714, in urlopen
  File "urllib3/connectionpool.py", line 403, in _make_request
  File "urllib3/connectionpool.py", line 1053, in _validate_conn
  File "urllib3/connection.py", line 363, in connect
  File "urllib3/connection.py", line 186, in _new_conn
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fe9d0cb0f20>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 486, in send
  File "urllib3/connectionpool.py", line 798, in urlopen
  File "urllib3/util/retry.py", line 592, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='p33-ckdatabasews.icloud.com', port=443): Max retries exceeded with url: /database/1/com.apple.photos.cloud/production/private/records/query?clientBuildNumber=17DHotfix5&clientMasteringNumber=17DHotfix5&ckjsBuildVersion=17DProjectDev77&ckjsVersion=2.0.5&clientId=auth-042df392-37cf-11ef-917f-02420a000302&dsid=16860606109&remapEnums=True&getCurrentSyncToken=True (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe9d0cb0f20>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "starters/icloudpd.py", line 6, in <module>
  File "click/core.py", line 1157, in __call__
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1434, in invoke
  File "click/core.py", line 783, in invoke
  File "icloudpd/base.py", line 552, in main
  File "icloudpd/base.py", line 1135, in core
  File "pyicloud_ipd/services/photos.py", line 383, in photos
  File "pyicloud_ipd/services/photos.py", line 363, in photos_request
  File "requests/sessions.py", line 637, in post
  File "pyicloud_ipd/session.py", line 65, in request
  File "requests/sessions.py", line 589, in request
  File "requests/sessions.py", line 703, in send
  File "requests/adapters.py", line 519, in send
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='p33-ckdatabasews.icloud.com', port=443): Max retries exceeded with url: /database/1/com.apple.photos.cloud/production/private/records/query?clientBuildNumber=17DHotfix5&clientMasteringNumber=17DHotfix5&ckjsBuildVersion=17DProjectDev77&ckjsVersion=2.0.5&clientId=auth-042df392-37cf-11ef-917f-02420a000302&dsid=16860606109&remapEnums=True&getCurrentSyncToken=True (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe9d0cb0f20>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
[920] Failed to execute script 'icloudpd' due to unhandled exception!
2024-07-04 19:25:58 ERROR    ***** Please post the above debug log, along with a description of your problem, here: https://github.com/boredazfcuk/docker-icloudpd/issues *****

If I restart it runs again, clearly it's not a Apple issue, just Internet jitter.

boredazfcuk commented 2 days ago

It's not a container issue, it's a name resolution problem as described in your error. Check your DNS server for issues, or use different ones. If that's OK,check your hardware and network for issues.

In the modern age of clustered, highly available, fault tolerant Internet based DNS servers, "Internet jitter" is not really a thing for them.

If you can't find the source of your problem, then I suspect the container should detect this error and mark the container as unhealthy. Just use a different container to automatically restart the unhealthy ones.