immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
49.63k stars 2.62k forks source link

iOS app: broken sync - local assets are not being displayed in the main timeline #11352

Open DaVinciEngineer opened 3 months ago

DaVinciEngineer commented 3 months ago

The bug

is it not possible to see not synced assets in the iOS app, however full background sync uploads them and then they gets displayed with "cloud" icon.

The OS that Immich Server is running on

Ubuntu 22.04.4 LTS

Version of Immich Server

v1.109.2

Version of Immich Mobile App

v1.109.0 build.164

Platform with the issue

Your docker-compose.yml content

-

Your .env content

-

Reproduction steps

1. fresh instance
2. created two users
3. configured full cross sharing of assets (from A to B, from B to A)
4. in the account A (android owner) I uploaded from web 4 assets and assigned them to the album.
5. I also shared this album to account B (iOS owner). 
6. Then I configured new url on the iOS app and I was able to see only 4 shared assets.

Result: Nothing from my local assets, but "Recents (all)" were selected.

Relevant log output

2024-07-25 14:33:18.562977 | SEVERE   | ImmichErrorLogger    | PlatformDispatcher - Catch all | PlatformException(Error Domain=PHPhotosErrorDomain Code=-1 "(null)", null, null, null) |
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334)
<asynchronous suspension>
#2      AssetEntity._getFile (package:photo_manager/src/types/entity.dart:735)
<asynchronous suspension>
#3      HashService._hashAssets (package:immich_mobile/services/hash.service.dart:57)
<asynchronous suspension>
#4      SyncService._addAlbumFromDevice (package:immich_mobile/services/sync.service.dart:687)
<asynchronous suspension>
#5      diffSortedLists (package:immich_mobile/utils/diff.dart:21)
<asynchronous suspension>
#6      SyncService._syncLocalAlbumAssetsToDb (package:immich_mobile/services/sync.service.dart:504)
<asynchronous suspension>
#7      AlbumService.refreshDeviceAlbums (package:immich_mobile/services/album.service.dart:118)
<asynchronous suspension>
#8      AssetNotifier.getAllAsset (package:immich_mobile/providers/asset.provider.dart:55)
<asynchronous suspension>
#9      PhotosPage.build.refreshAssets (package:immich_mobile/pages/photos/photos.page.dart:86)
<asynchronous suspension>
#10     MultiselectGrid.build.wrapLongRunningFun.<anonymous closure> (package:immich_mobile/widgets/asset_grid/multiselect_grid.dart:396)
<asynchronous suspension>
#11     RefreshIndicatorState._show.<anonymous closure>.<anonymous closure> (package:flutter/src/material/refresh_indicator.dart:503)
<asynchronous suspension>

2024-07-25 14:33:18.503561 | INFO     | BackupNotifier       | _getBackupAlbumsInfo: Found 24 available albums |
2024-07-25 14:33:18.502882 | INFO     | BackupNotifier       | Found 24 local albums |
2024-07-25 14:33:17.019306 | INFO     | SyncService          | Syncing a new local album to DB: Recents |
2024-07-25 14:33:17.018828 | INFO     | AlbumService         | Found 18 device albums |
2024-07-25 14:33:16.557565 | SEVERE   | ImmichErrorLogger    | PlatformDispatcher - Catch all | PlatformException(Error Domain=PHPhotosErrorDomain Code=-1 "(null)", null, null, null) |
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334)
<asynchronous suspension>
#2      AssetEntity._getFile (package:photo_manager/src/types/entity.dart:735)
<asynchronous suspension>
#3      HashService._hashAssets (package:immich_mobile/services/hash.service.dart:57)
<asynchronous suspension>
#4      SyncService._addAlbumFromDevice (package:immich_mobile/services/sync.service.dart:687)
<asynchronous suspension>
#5      diffSortedLists (package:immich_mobile/utils/diff.dart:21)
<asynchronous suspension>
#6      SyncService._syncLocalAlbumAssetsToDb (package:immich_mobile/services/sync.service.dart:504)
<asynchronous suspension>
#7      AlbumService.refreshDeviceAlbums (package:immich_mobile/services/album.service.dart:118)
<asynchronous suspension>

2024-07-25 14:33:13.318450 | SEVERE   | ImmichErrorLogger    | PlatformDispatcher - Catch all | PlatformException(Error Domain=PHPhotosErrorDomain Code=-1 "(null)", null, null, null) |
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334)
<asynchronous suspension>
#2      AssetEntity._getFile (package:photo_manager/src/types/entity.dart:735)
<asynchronous suspension>
#3      HashService._hashAssets (package:immich_mobile/services/hash.service.dart:57)
<asynchronous suspension>
#4      SyncService._addAlbumFromDevice (package:immich_mobile/services/sync.service.dart:687)
<asynchronous suspension>
#5      diffSortedLists (package:immich_mobile/utils/diff.dart:21)
<asynchronous suspension>
#6      SyncService._syncLocalAlbumAssetsToDb (package:immich_mobile/services/sync.service.dart:504)
<asynchronous suspension>
#7      AlbumService.refreshDeviceAlbums (package:immich_mobile/services/album.service.dart:118)
<asynchronous suspension>

2024-07-25 14:33:11.869694 | INFO     | SyncService          | Syncing a new local album to DB: Recents |
2024-07-25 14:33:11.869153 | INFO     | AlbumService         | Found 18 device albums |
2024-07-25 14:33:04.083156 | INFO     | BackupNotifier       | _getBackupAlbumsInfo: Found 24 available albums |
2024-07-25 14:33:04.082664 | INFO     | BackupNotifier       | Found 24 local albums |
2024-07-25 14:33:01.337935 | INFO     | AlbumService         | Syncing completed. Changes: false |
2024-07-25 14:33:01.326202 | INFO     | AlbumService         | 'Recents' is not selected, keeping only selected albums |
2024-07-25 14:33:01.326113 | INFO     | AlbumService         | Found 18 device albums |
2024-07-25 14:32:55.806981 | INFO     | BackupNotifier       | _getBackupAlbumsInfo: Found 24 available albums |
2024-07-25 14:32:55.806400 | INFO     | BackupNotifier       | Found 24 local albums |
2024-07-25 14:32:45.709417 | INFO     | AlbumService         | Syncing completed. Changes: false |
2024-07-25 14:32:45.696722 | INFO     | AlbumService         | 'Recents' is not selected, keeping only selected albums |
2024-07-25 14:32:45.696630 | INFO     | AlbumService         | Found 18 device albums |
2024-07-25 14:32:40.214103 | INFO     | BackupNotifier       | _getBackupAlbumsInfo: Found 24 available albums |
2024-07-25 14:32:40.213599 | INFO     | BackupNotifier       | Found 24 local albums |
2024-07-25 14:32:39.071017 | INFO     | BackupNotifier       | _getBackupAlbumsInfo: Found 24 available albums |
2024-07-25 14:32:39.070423 | INFO     | BackupNotifier       | Found 24 local albums |
2024-07-25 14:32:37.235327 | INFO     | AssetNotifier        | Load assets: 478ms |
2024-07-25 14:32:37.235263 | INFO     | AlbumService         | Syncing completed. Changes: false |
2024-07-25 14:32:37.222780 | INFO     | AlbumService         | 'Recents' is not selected, keeping only selected albums |
2024-07-25 14:32:37.222706 | INFO     | AlbumService         | Found 18 device albums |
2024-07-25 14:32:33.652871 | INFO     | AlbumService         | Syncing completed. Changes: true |
2024-07-25 14:32:33.652860 | INFO     | SyncService          | Removed 5 and updated 0 local assets from DB |
2024-07-25 14:32:33.651061 | INFO     | SyncService          | Added a new local album to DB: Selfies |
2024-07-25 14:32:33.609994 | INFO     | SyncService          | Upserted 960 assets into the DB |
2024-07-25 14:32:33.595179 | INFO     | SyncService          | 0 assets already existed in DB, to upsert 960 |
2024-07-25 14:32:33.592371 | WARNING  | SyncService          | Ignored 1 duplicate assets on device |
2024-07-25 14:32:33.592021 | INFO     | SyncService          | Ignoring duplicate assets on device:
{
  "id": "N/A",
  "remoteId": "N/A",
  "localId": "795CC99F-FA85-410E-A566-F493732C5462/L0/001",
  "checksum": "1xYlR925rlk3T3pvIU+hpxPvSIE=",
  "ownerId": 5452190345421599613,
  "livePhotoVideoId": "N/A",
  "stackCount": "0",
  "stackParentId": "N/A",
  "fileCreatedAt": "2024-07-06 16:51:37.000",
  "fileModifiedAt": "2024-07-07 12:51:15.000",
  "updatedAt": "2024-07-07 12:51:15.000",
  "durationInSeconds": 0,
  "type": "AssetType.image",
  "fileName": "",
  "isFavorite": false,
  "isRemote": false,
  "storage": "AssetState.local",
  "width": 4032,
  "height": 3024,
  "isArchived": false,
  "isTrashed": false,
  "isOffline": false,
}
{
  "id": "N/A",
  "remoteId": "N/A",
  "localId": "3424CF35-D41B-46C2-B717-C4502BDC2780/L0/001",
  "checksum": "1xYlR925rlk3T3pvIU+hpxPvSIE=",
  "ownerId": 5452190345421599613,
  "livePhotoVideoId": "N/A",
  "stackCount": "0",
  "stackParentId": "N/A",
  "fileCreatedAt": "2024-07-06 16:51:37.000",
  "fileModifiedAt": "2024-07-07 12:51:15.000",
  "updatedAt": "2024-07-07 12:51:15.000",
  "durationInSeconds": 0,
  "type": "AssetType.image",
  "fileName": "",
  "isFavorite": false,
  "isRemote": false,
  "storage": "AssetState.local",
  "width": 4032,
  "height": 3024,
  "isArchived": false,
  "isTrashed": false,
  "isOffline": false,
} |
2024-07-25 14:32:33.510717 | INFO     | SyncService          | Syncing a new local album to DB: Selfies |
2024-07-25 14:32:33.510704 | INFO     | SyncService          | Removed local album Favorites from DB |
2024-07-25 14:32:33.509675 | INFO     | SyncService          | Removing local album Favorites from DB |
2024-07-25 14:32:33.509362 | SEVERE   | ImmichErrorLogger    | PlatformDispatcher - Catch all | PlatformException(Error Domain=PHPhotosErrorDomain Code=-1 "(null)", null, null, null) |
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334)
<asynchronous suspension>
#2      AssetEntity._getFile (package:photo_manager/src/types/entity.dart:735)
<asynchronous suspension>
#3      HashService._hashAssets (package:immich_mobile/services/hash.service.dart:57)
<asynchronous suspension>
#4      SyncService._addAlbumFromDevice (package:immich_mobile/services/sync.service.dart:687)
<asynchronous suspension>
#5      diffSortedLists (package:immich_mobile/utils/diff.dart:21)
<asynchronous suspension>
#6      SyncService._syncLocalAlbumAssetsToDb (package:immich_mobile/services/sync.service.dart:504)
<asynchronous suspension>
#7      AlbumService.refreshDeviceAlbums (package:immich_mobile/services/album.service.dart:118)
<asynchronous suspension>
#8      AssetNotifier.getAllAsset (package:immich_mobile/providers/asset.provider.dart:55)
<asynchronous suspension>
#9      PhotosPage.build.refreshAssets (package:immich_mobile/pages/photos/photos.page.dart:86)
<asynchronous suspension>
#10     MultiselectGrid.build.wrapLongRunningFun.<anonymous closure> (package:immich_mobile/widgets/asset_grid/multiselect_grid.dart:396)
<asynchronous suspension>
#11     RefreshIndicatorState._show.<anonymous closure>.<anonymous closure> (package:flutter/src/material/refresh_indicator.dart:503)
<asynchronous suspension>

2024-07-25 14:32:33.509242 | INFO     | AlbumService         | 'Recents' is not selected, keeping only selected albums |
2024-07-25 14:32:33.509151 | INFO     | AlbumService         | Found 18 device albums |
2024-07-25 14:32:28.743404 | INFO     | BackupNotifier       | _getBackupAlbumsInfo: Found 24 available albums |
2024-07-25 14:32:28.742694 | INFO     | BackupNotifier       | Found 24 local albums |
2024-07-25 14:32:27.163962 | INFO     | BackupNotifier       | _getBackupAlbumsInfo: Found 24 available albums |
2024-07-25 14:32:27.163352 | INFO     | BackupNotifier       | Found 24 local albums |
2024-07-25 14:32:13.701664 | FINE     | socket_io_client:engine.Socket | socket close with reason: "transport error" |
2024-07-25 14:32:13.701653 | FINE     | socket_io_client:Manager | will wait %dms before reconnect attempt | 5000 |
2024-07-25 14:32:13.701636 | FINE     | socket_io_client:Manager | reconnect attempt error |
2024-07-25 14:32:13.701614 | FINE     | socket_io_client:Manager | cleanup |
2024-07-25 14:32:13.701602 | FINE     | socket_io_client:Manager | connect_error |
2024-07-25 14:32:13.701535 | FINE     | socket_io_client:engine.Socket | socket error WebSocketException: Connection to 'https://mydomainwashere.com:0/api/socket.io/?EIO=4&transport=websocket#' was not upgraded to websocket |
2024-07-25 14:32:13.620053 | FINE     | socket_io_client:Manager | connect attempt will timeout after 20000 |
2024-07-25 14:32:13.620023 | FINE     | socket_io_client:engine.Socket | setting transport websocket |
2024-07-25 14:32:13.619840 | FINE     | socket_io_client:engine.Socket | creating transport "websocket" |
2024-07-25 14:32:13.619575 | FINE     | socket_io_client:Manager | opening https://mydomainwashere.com |
2024-07-25 14:32:13.619558 | FINE     | socket_io_client:Manager | readyState closed |
2024-07-25 14:32:13.619469 | FINE     | socket_io_client:Manager | attempting reconnect |
2024-07-25 14:32:08.617418 | FINE     | socket_io_client:engine.Socket | socket close with reason: "transport error" |
2024-07-25 14:32:08.617391 | FINE     | socket_io_client:Manager | will wait %dms before reconnect attempt | 5000 |
2024-07-25 14:32:08.617357 | FINE     | socket_io_client:Manager | reconnect attempt error |
2024-07-25 14:32:08.617299 | FINE     | socket_io_client:Manager | cleanup |
2024-07-25 14:32:08.617269 | FINE     | socket_io_client:Manager | connect_error |
2024-07-25 14:32:08.617182 | FINE     | socket_io_client:engine.Socket | socket error WebSocketException: Connection to 'https://mydomainwashere.com:0/api/socket.io/?EIO=4&transport=websocket#' was not upgraded to websocket |
2024-07-25 14:32:08.532833 | FINE     | socket_io_client:Manager | connect attempt will timeout after 20000 |
2024-07-25 14:32:08.532788 | FINE     | socket_io_client:engine.Socket | setting transport websocket |
2024-07-25 14:32:08.532445 | FINE     | socket_io_client:engine.Socket | creating transport "websocket" |
2024-07-25 14:32:08.532261 | FINE     | socket_io_client:Manager | opening https://mydomainwashere.com |
2024-07-25 14:32:08.532226 | FINE     | socket_io_client:Manager | readyState closed |
2024-07-25 14:32:08.532074 | FINE     | socket_io_client:Manager | attempting reconnect |

Additional information

No response

alextran1502 commented 3 months ago

@fyfrey Do you have any thoughts on this? I am planning to dive into the code to see what could be the issue there but figure to ask your opinion first.

fyfrey commented 3 months ago

The hashing code written in native iOS code (Swift?) occurs an error... Due to something. This makes the entire chain in dart abort as well. So, this is an iOS file issue or bug in our swift code.

MagicLinus commented 2 months ago

If this issue has been resolved? After updating to the latest version 1.112.1, the corresponding app on my IOS device also encountered the same problem, which is particularly confusing. The local photo album on the mobile phone cannot be fully displayed on the timeline, but if you choose to synchronize recent projects, it can be fully uploaded to the server. However, the problem is that the local server does not have these photos available. I feel like the problem lies with the mobile app, but I'm not sure if there's a problem with the server. During the detection process, there will be an error message on the mobile terminal. _MESSAGE Platform Dispatcher - Catchall (FROM ImmichError Logger),. DETIALS:PlatformException(Error Domain=PHPhotosErrorDomain Code=-1 "(null)", null, null, null) STACK TRACE:#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648)_

#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334)
<asynchronous suspension>
#2      AssetEntity._getFile (package:photo_manager/src/types/entity.dart:735)
<asynchronous suspension>
#3      HashService._hashAssets (package:immich_mobile/services/hash.service.dart:57)
<asynchronous suspension>
#4      SyncService._addAlbumFromDevice (package:immich_mobile/services/sync.service.dart:687)
<asynchronous suspension>
#5      diffSortedLists (package:immich_mobile/utils/diff.dart:30)
<asynchronous suspension>
#6      SyncService._syncLocalAlbumAssetsToDb (package:immich_mobile/services/sync.service.dart:504)
<asynchronous suspension>
#7      AlbumService.refreshDeviceAlbums (package:immich_mobile/services/album.service.dart:118)
<asynchronous suspension>
#8      AssetNotifier.getAllAsset (package:immich_mobile/providers/asset.provider.dart:55)
<asynchronous suspension>
#9      PhotosPage.build.refreshAssets (package:immich_mobile/pages/photos/photos.page.dart:86)
<asynchronous suspension>
#10     MultiselectGrid.build.wrapLongRunningFun.<anonymous closure> (package:immich_mobile/widgets/asset_grid/multiselect_grid.dart:396)
<asynchronous suspension>
#11     RefreshIndicatorState._show.<anonymous closure>.<anonymous closure> (package:flutter/src/material/refresh_indicator.dart:503)
<asynchronous suspension>

—————————————————————————— —————————————————————————— Finally, I have identified the key reason that triggered this issue. After investigating each of my over 30,000 images and videos, I discovered that a particularly loooooooooooong-named image caused the interruption of the local album scanning process. Everything returned to normal after I deleted this problematic image. For users of IOS devices who are experiencing similar issues, you may refer to my solution for this problem.

In addition, I have two more questions: 1,Could the developers consider fixing this issue in a future iterative update of the APP? Identifying the problematic filename is not an easy task, especially when dealing with a vast number of photos. 2,When playing videos using the Immich APP on IOS, it feels like there's a filter applied, making the colors appear lighter or colder than they do when played normally in the phone's album. The colors are not authentic. I'm using an Iphone12, and I'm wondering if other users are experiencing the same issue. I also hope that the developers can address this issue. ![Uploading errorPIC.png…]()

ankit5902 commented 2 months ago

I am also facing the same issue, logs below:

https://github.com/immich-app/immich/issues/11519#issuecomment-2294867533