Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting photos causes immich android app to get into a bad state. #15541

Open
2 of 3 tasks
shawzymoto opened this issue Jan 22, 2025 · 5 comments
Open
2 of 3 tasks

Deleting photos causes immich android app to get into a bad state. #15541

shawzymoto opened this issue Jan 22, 2025 · 5 comments

Comments

@shawzymoto
Copy link

shawzymoto commented Jan 22, 2025

The bug

I will delete a photo sometimes and its fine. I think its when i delete a photo from the server as well that it seems to hang. I just get the spinner indefinitely. I will kill the app and try to come back in and it will show the pictures but the icon that shows the backup status just keeps spinning. When i check the server the version isnt blank like it cant connect to the server. I have to log out and back in for it to restore.

The OS that Immich Server is running on

Debian

Version of Immich Server

v1.24.2

Version of Immich Mobile App

v1.24.2

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - ${EXTERNAL_PATH}:/usr/src/app/external
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:2283
    depends_on:
      - redis
      - database
    restart: unless-stopped
    labels:
      - "traefik.http.routers.immich-server.rule=Host(`[this is my custom internal domain]`)"
    networks:
      - shared-network

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: unless-stopped
    networks:
      - shared-network

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:d6c2911ac51b289db208767581a5d154544f2b2fe4914ea5056443f62dc6e900
    healthcheck:
      test: redis-cli ping || exit 1
    restart: unless-stopped
    networks:
      - shared-network

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      start_interval: 30s
      start_period: 5m
    command: ["postgres", "-c" ,"shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
    restart: unless-stopped
    networks:
      - shared-network


  pgbackups:
    image: prodrigestivill/postgres-backup-local
    restart: unless-stopped
    user: postgres:postgres
    volumes:
        - ${DB_BACKUP_LOCATION}:/backups
    links:
        - database
    depends_on:
        - database
    environment:
        - POSTGRES_HOST=database
        - POSTGRES_DB=${DB_DATABASE_NAME}
        - POSTGRES_USER=${DB_USERNAME}
        - POSTGRES_PASSWORD=${DB_PASSWORD}
     #  - POSTGRES_PASSWORD_FILE=/run/secrets/db_password <-- alternative for POSTGRES_PASSWORD (to use with docker secrets)
        - POSTGRES_EXTRA_OPTS=-Z1 --schema=public --blobs
        - SCHEDULE=@daily
        - BACKUP_KEEP_DAYS=7
        - BACKUP_KEEP_WEEKS=4
        - BACKUP_KEEP_MONTHS=6
        - HEALTHCHECK_PORT=8080
    networks:
      - shared-network

volumes:
  model-cache:

networks:
  shared-network:
    external: true

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/immich-photos

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
#IMMICH_VERSION=release
IMMICH_VERSION=v1.124.2

# Connection secret for postgres. You should change it to a random password
DB_PASSWORD=[nice try]

EXTERNAL_PATH=/mnt/immich-external

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
DB_DATA_LOCATION=./postgres
DB_BACKUP_LOCATION=/mnt/immich-db


REDIS_HOSTNAME=immich_redis

PORTAINER_DATA=./portainer_data

Reproduction steps

  1. android mobile app
  2. delete images
  3. i was able to delete a couple and then on the 3rd it hung.

...

Relevant log output

Error getting user information from the server [CATCH ALL]

Additional information

No response

@shawzymoto
Copy link
Author

The only other thing i could think of that i had done recently was install immich tv on my google chromecast tv. I have its screensaver coming from immich tv.

Would this cause issues deleting photos? its a stretch but its all i can think of.

@shawzymoto
Copy link
Author

i was able to get this out of the log as well.

Failed to delete asset from device

PlatformException(deleteWithIds failed, 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)

#2 PhotoManagerPlugin.deleteWithIds (package:photo_manager/src/internal/plugin.dart:340)

#3 AssetNotifier._deleteLocalAssets (package:immich_mobile/providers/asset.provider.dart:275)

#4 AssetNotifier.deleteAssets (package:immich_mobile/providers/asset.provider.dart:187)

#5 MultiselectGrid.build.onDelete (package:immich_mobile/widgets/asset_grid/multiselect_grid.dart:183)

@shawzymoto
Copy link
Author

and this...........

#0 AssetPathEntity.obtainPathFromProperties (package:photo_manager/src/types/entity.dart:162)

#1 AssetPathEntity.fromId (package:photo_manager/src/types/entity.dart:59)

#2 AlbumMediaRepository.getAssets (package:immich_mobile/repositories/album_media.repository.dart:44)

#3 HashService.getHashedAssets (package:immich_mobile/services/hash.service.dart:38)

#4 SyncService._syncDeviceAlbumFast (package:immich_mobile/services/sync.service.dart:656)

#5 SyncService._syncAlbumInDbAndOnDevice (package:immich_mobile/services/sync.service.dart:563)

#6 diffSortedLists (package:immich_mobile/utils/diff.dart:23)

#7 SyncService._syncLocalAlbumAssetsToDb (package:immich_mobile/services/sync.service.dart:510)

#8 AlbumService.refreshDeviceAlbums (package:immich_mobile/services/album.service.dart:132)

#9 AssetNotifier.getAllAsset (package:immich_mobile/providers/asset.provider.dart:56)

#10 AppLifeCycleNotifier.handleAppResume (package:immich_mobile/providers/app_life_cycle.provider.dart:67)

@Saschl
Copy link
Contributor

Saschl commented Jan 23, 2025

I think I found the culprit for the issue:

When the next image is being loaded after deleting the first one, the new asset is loaded correctly and display (https://github.com/immich-app/immich/blob/main/mobile/lib/pages/common/gallery_viewer.page.dart#L264), but "currentAssetProvider" is never updated, as the image did not change view "onPageChange"

When trying the next delete, https://github.com/immich-app/immich/blob/main/mobile/lib/widgets/asset_viewer/bottom_gallery_bar.dart#L78 tries to perform a deletion of the previous asset, which likely fails.

@shawzymoto
Copy link
Author

@Saschl it might be the culprit? im not sure but im using the android app. does the same code exist on that client as well?

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

No branches or pull requests

2 participants