mandarons / icloud-docker

Dockerized iCloud Client - make a local copy of your iCloud documents and photos, and keep it automatically up-to-date.
BSD 3-Clause "New" or "Revised" License
1.07k stars 49 forks source link

[BUG] Request Timeout (408) #173

Open alexsidorin opened 10 months ago

alexsidorin commented 10 months ago

Thanks a lot for this app, this is what I was looking for a lot to back up my iCloud to Synology NAS. So I am running it in Docker. First run on photos - around 30k synced. But after it crashes, I cant figure out why.

Describe the bug Docker crash, logs:

iCloud-Sync
date,stream,content
2023/11/12 11:51:39,stdout,icloudpy.exceptions.ICloudPyAPIResponseException: Request Timeout (408)

2023/11/12 11:51:39,stdout,    raise api_error

2023/11/12 11:51:39,stdout,"  File \"/app/venv/lib/python3.10/site-packages/icloudpy/base.py\", line 187, in _raise_error
"
2023/11/12 11:51:39,stdout,"    self._raise_error(response.status_code, response.reason)
"
2023/11/12 11:51:39,stdout,"  File \"/app/venv/lib/python3.10/site-packages/icloudpy/base.py\", line 131, in request
"
2023/11/12 11:51:39,stdout,"    return self.request(\"POST\", url, data=data, json=json, **kwargs)
"
2023/11/12 11:51:39,stdout,"  File \"/app/venv/lib/python3.10/site-packages/requests/sessions.py\", line 635, in post
"
2023/11/12 11:51:39,stdout,    request = self.service.session.post(

2023/11/12 11:51:39,stdout,"  File \"/app/venv/lib/python3.10/site-packages/icloudpy/services/photos.py\", line 453, in photos
"
2023/11/12 11:51:39,stdout,    for photo in album:

2023/11/12 11:51:39,stdout,"  File \"/app/src/sync_photos.py\", line 126, in sync_album
"
2023/11/12 11:51:39,stdout,    sync_album(

2023/11/12 11:51:39,stdout,"  File \"/app/src/sync_photos.py\", line 193, in sync_photos
"
2023/11/12 11:51:39,stdout,"    sync_photos.sync_photos(config=config, photos=api.photos)
"
2023/11/12 11:51:39,stdout,"  File \"/app/src/sync.py\", line 87, in sync
"
2023/11/12 11:51:39,stdout,    sync.sync()

2023/11/12 11:51:39,stdout,"  File \"/app/./src/main.py\", line 7, in <module>
"
2023/11/12 11:51:39,stdout,Traceback (most recent call last):

2023/11/12 11:51:39,stdout,"2023-11-12 08:51:39,080 :: ERROR :: icloudpy.base :: base.py :: 186 :: Request Timeout (408)
"
2023/11/12 11:51:39,stdout,"2023-11-12 08:51:39,079 :: DEBUG :: icloudpy.base :: base.py :: 98 :: Cookies saved to session_data/xxxxx
"
2023/11/12 11:51:39,stdout,"2023-11-12 08:51:39,076 :: DEBUG :: icloudpy.base :: base.py :: 94 :: Saved session data to file
"
2023/11/12 11:51:39,stdout,"2023-11-12 08:51:39,075 :: DEBUG :: urllib3.connectionpool :: connectionpool.py :: 474 :: https://p58-ckdatabasews.icloud.com:443 \"POST /database/1/com.apple.photos.cloud/production/private/records/query?remapEnums=True&getCurrentSyncToken=True HTTP/1.1\" 408 0
"
2023/11/12 11:49:39,stdout,"2023-11-12 08:49:39,028 :: DEBUG :: icloudpy.services.photos.http :: base.py :: 75 :: POST https://p58-ckdatabasews.icloud.com:443/database/1/com.apple.photos.cloud/production/private/records/query?remapEnums=True&getCurrentSyncToken=True {\"query\": {\"filterBy\": [{\"fieldName\": \"startRank\", \"fieldValue\": {\"type\": \"INT64\", \"value\": 5894}, \"comparator\": \"EQUALS\"}, {\"fieldName\": \"direction\", \"fieldValue\": {\"type\": \"STRING\", \"value\": \"ASCENDING\"}, \"comparator\": \"EQUALS\"}], \"recordType\": \"CPLAssetAndMasterByAddedDate\"}, \"resultsLimit\": 200, \"desiredKeys\": [\"resJPEGFullWidth\", \"resJPEGFullHeight\", \"resJPEGFullFileType\", \"resJPEGFullFingerprint\", \"resJPEGFullRes\", \"resJPEGLargeWidth\", \"resJPEGLargeHeight\", \"resJPEGLargeFileType\", \"resJPEGLargeFingerprint\", \"resJPEGLargeRes\", \"resJPEGMedWidth\", \"resJPEGMedHeight\", \"resJPEGMedFileType\", \"resJPEGMedFingerprint\", \"resJPEGMedRes\", \"resJPEGThumbWidth\", \"resJPEGThumbHeight\", \"resJPEGThumbFileType\", \"resJPEGThumbFingerprint\", \"resJPEGThumbRes\", \"resVidFullWidth\", \"resVidFullHeight\", \"resVidFullFileType\", \"resVidFullFingerprint\", \"resVidFullRes\", \"resVidMedWidth\", \"resVidMedHeight\", \"resVidMedFileType\", \"resVidMedFingerprint\", \"resVidMedRes\", \"resVidSmallWidth\", \"resVidSmallHeight\", \"resVidSmallFileType\", \"resVidSmallFingerprint\", \"resVidSmallRes\", \"resSidecarWidth\", \"resSidecarHeight\", \"resSidecarFileType\", \"resSidecarFingerprint\", \"resSidecarRes\", \"itemType\", \"dataClassType\", \"filenameEnc\", \"originalOrientation\", \"resOriginalWidth\", \"resOriginalHeight\", \"resOriginalFileType\", \"resOriginalFingerprint\", \"resOriginalRes\", \"resOriginalAltWidth\", \"resOriginalAltHeight\", \"resOriginalAltFileType\", \"resOriginalAltFingerprint\", \"resOriginalAltRes\", \"resOriginalVidComplWidth\", \"resOriginalVidComplHeight\", \"resOriginalVidComplFileType\", \"resOriginalVidComplFingerprint\", \"resOriginalVidComplRes\", \"isDeleted\", \"isExpunged\", \"dateExpunged\", \"remappedRef\", \"recordName\", \"recordType\", \"recordChangeTag\", \"masterRef\", \"adjustmentRenderType\", \"assetDate\", \"addedDate\", \"isFavorite\", \"isHidden\", \"orientation\", \"duration\", \"assetSubtype\", \"assetSubtypeV2\", \"assetHDRType\", \"burstFlags\", \"burstFlagsExt\", \"burstId\", \"captionEnc\", \"locationEnc\", \"locationV2Enc\", \"locationLatitude\", \"locationLongitude\", \"adjustmentType\", \"timeZoneOffset\", \"vidComplDurValue\", \"vidComplDurScale\", \"vidComplDispValue\", \"vidComplDispScale\", \"vidComplVisibilityState\", \"customRenderedValue\", \"containerId\", \"itemId\", \"position\", \"isKeyAsset\"], \"zoneID\": {\"zoneName\": \"PrimarySync\", \"ownerRecordName\": \"_b6297cf0d56c18da207d60fbefe9ed03\", \"zoneType\": \"REGULAR_CUSTOM_ZONE\"}}
"
2023/11/12 11:49:39,stdout,"2023-11-12 08:49:39,027 :: DEBUG :: root :: sync_photos.py :: 71 :: No changes detected. Skipping the file /app/icloud/Photos/all/2021 - July/IMG_5589__original__QWZkU29vNzBsOVlEWlEvYnpLa3pmMXphcWljdQ==.HEIC ...
"

Configuration config:

app:
  logger:
    # level - debug, info (default), warning or error
    level: "debug"
    # log filename icloud.log (default)
    filename: "icloud.log"
  region: global
  credentials:
    username: "xxxxx"
    retry_login_interval: 600
  root: "icloud"
photos:
  destination: "Photos"
  remove_obsolete: true
  folder_format: "%Y - %B"
  sync_inteval: 86400

This happens every time now, it seems the flow stopped on some photo or album. Any clue?

mandarons commented 10 months ago

Is it consistently occurring for IMG_5589originalQWZkU29vNzBsOVlEWlEvYnpLa3pmMXphcWljdQ==.HEIC? Request timeout typically indicates network problem.

mandarons commented 2 months ago

Is it still an issue with version 1.20.0?