immich-app / immich

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

background backup worker not work #7124

Open BenjaminCz0101 opened 9 months ago

BenjaminCz0101 commented 9 months ago

The bug

Hello I have the problem that the images in the background are not uploaded. If I activate the foreground backup, the foreground backup works. I just wanted to select a few albums and then upload them in the background, but that doesn't work. I have Samsung Android 13 and battery optimization turned off notification on. Otherwise I am very enthusiastic about the app!!

The OS that Immich Server is running on

Debian 12

Version of Immich Server

v 1.94.1

Version of Immich Mobile App

v 1.94.1

Platform with the issue

Your docker-compose.yml content

version: "3.8"

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding
    #   file: hwaccel.transcoding.yml 
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  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: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:afb290a0a0d0b2bd7537b62ebff1eb84d045c757c1c31ca2ca48c79536c0de82
    restart: always

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.1.11@sha256:0335a1a22f8c5dd1b697f14f079934f5152eaaa216c09b61e293be285491f8ee
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

volumes:
  pgdata:
  model-cache:

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/Bilder/immich/immich

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

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

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis

Reproduction steps

1. Select Album(s) to Backup my Phone
2. Closing Immich App an Waiting to Upload from Phone to Server
3. Until 5 minutes Check if Images Uploaded 
4. Nothing Uploaded
...

Additional information

No response

BenjaminCz0101 commented 9 months ago

Hey Does no one have the same or similar problems? Or is it the smartphone? I also tried it with Android 10 on the tablet but the same problem.

gael1980 commented 9 months ago

Hello, I have the same problem with an iPhone SE2 or XR with the latest version of ios. I have the same immich configuration

lidtzig commented 9 months ago

Same here. Since last update, 4 tel on 5 don't synchro files. Need to lunch immich manually and stay on app.

BenjaminCz0101 commented 9 months ago

Hello, I have now tested several devices with different Android versions and the same problem here too. I also tried it without an external library, same result. Has anyone tried a workaround or with a lower version?

detxm80 commented 9 months ago

I ve same problem. Iphone 11 ios 17. If i close app it lose setting (album, automatic backup ecc ecc)

Chuckame commented 9 months ago

Same with the latest Samsung and the pixel 6a

conorlap commented 9 months ago

Same issue here on Android/Samsung for the past few months!

jnelson22 commented 7 months ago

Same here iPhone 15, iOS 17.4.1

alextran1502 commented 7 months ago

For Samsung users, please follow the steps in https://dontkillmyapp.com/. Go to phone Settings > Apps > Immich > Battery > Unrestricted

For iPhone users, please disable as many background app refresh for apps that you don't use as you can, this will help to let the iOS scheduler to allow background task to run on Immich

0verEngineer commented 6 months ago

@alextran1502 My Mom has a Samsung Galaxy S24 with Android 14 and setting the App to unrestricted does not work.

ChrisiHill commented 5 months ago

Posting here to say its still happening with both iPhone and Androids

dohlin commented 5 months ago

I too am having this issue with my S24 Ultra, everything (app, phone, server, etc.) updated to latest version as of this writing. Occasionally I'll get a 'connection to server failed" notification even though I can manually open a chrome browser and hit the web UI from my phone, and none of my other self-hosted apps that go through the exact same reverse proxy server have any issues with connections. The split second I open my Immich app everything starts uploading instantly. Something definitely seems to be bugged with the background upload worker here.

kazink commented 4 months ago

7673 might be the same issue. I also have it on Ulefone Armor 3WT (Android 9). The background process shows in notifications sometimes, but it doesn't upload any newly taken photos (WiFi-only is off). The foreground upload starts immediately once I start the app. The app has the storage permission, and the battery optimization is disabled.

samex commented 1 week ago

I encountered the same issue on Android (LineageOS) but managed to resolve it. Here's what worked for me: