immich-app / immich

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

[BUG] Immich app continously reuploads images #3201

Closed easez88 closed 10 months ago

easez88 commented 1 year ago

The bug

Immich IOS app appears to continuously try to upload the same images. The issue that I had to reinitialize Immich and used the CLI to upload all the images previously uploaded from my phone to Immich again. Now when I open the app, Immich starts attempting to back up photos on my phone, assume sees that they exist in the server already and ignores them. The Total Number and remainder number go down all the way to zero, but the back up number never increases.

I believe the issue is that the app checks to see if the app is already in the server and does not reupload it, but it does not mark it as uploaded so it does not try to back it up again next time the back up job runs or when the app opens.

Please let me know if this is not clear. I can try to explain better.

The OS that Immich Server is running on

Fedora 37

Version of Immich Server

v1.66.1

Version of Immich Mobile App

v1.66.0 Build.106

Platform with the issue

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "immich" ]
    volumes:
      - data:/usr/src/app/upload
    env_file:
      - stack.env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - postgres
      - typesense
    restart: always
    ports:
      - 3001:3001

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "microservices" ]
    volumes:
      - data:/usr/src/app/upload
    env_file:
      - stack.env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - postgres
      - typesense
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    deploy:
        resources:
            limits:
              cpus: "0.5"
    volumes:
      - data:/usr/src/app/upload
      - model-cache:/cache
    env_file:
      - stack.env
    restart: always

  immich-web:
    container_name: immich_web
    image: ghcr.io/immich-app/immich-web:${IMMICH_VERSION:-release}
    env_file:
      - stack.env
    restart: always
    ports:
      - 3000:3000

  typesense:
    container_name: immich_typesense
    image: typesense/typesense:0.24.0
    environment:
      - TYPESENSE_DATA_DIR=/data
    env_file:
      - stack.env
    logging:
      driver: none
    volumes:
      - tsdata:/data
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

  postgres:
    container_name: immich_postgres
    image: postgres:14
    env_file:
      - stack.env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

volumes:
  data:
  pgdata:
  model-cache:
  tsdata:

Your .env content

DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_PASSWORD=PASSWORD
DB_DATABASE_NAME=immich
REDIS_HOSTNAME=immich_redis
UPLOAD_LOCATION=/location
DISABLE_REVERSE_GEOCODING=false
REVERSE_GEOCODING_PRECISION=3
PUBLIC_LOGIN_PAGE_MESSAGE="My photos"
IMMICH_WEB_URL=http://immich-web:3000
IMMICH_SERVER_URL=http://immich-server:3001
IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003
TYPESENSE_API_KEY=APIKEY

Reproduction steps

1. Set up immich 
2. Upload previously backed up photos using immich upload cli command. 
3. Set up app on phone
4. Start upload. 
5. Immich will recognize process each photo and recognize that they don't need to be uploaded again. 
6. Wait for back up to finish, then close and reopen immich. 
5. Processing will start again. 
...

Additional information

No response

lividhen commented 1 year ago

Also experiencing this

alextran1502 commented 1 year ago

@easez88 Sorry for not responding to this. What you are experiencing is the expected behavior. Since the assets were uploaded from the CLI, the mobile app uploading process will receive a status code from the server stating the assets existed on the server, therefore the app would black-listing them so that they won't be uploaded again for the following runs.

@lividhen Is your behavior similar to OP? that you upload from the CLI first then upload from the mobile?

The future improvement will be calculating the hash of the assets from the mobile app and then check the hash with the server to avoid uploading assets to the server for duplication checking, therefore reducing bandwidth and less confusing

lividhen commented 1 year ago

Yes that is correct. I have since fixed it as it was an issue with my reverse proxy which I hadn't realized, so I'm not sure how much immich was involved.

easez88 commented 1 year ago

Ok good to know thatnks