immich-app / immich

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

[BUG] Web stops working when multiple tabs are open #5856

Open eygraber opened 11 months ago

eygraber commented 11 months ago

The bug

After updating to 1.91.4 I had the website open in a few tabs. I was merging some people, adding some birthdays, and suddenly everything stopped loading. Refreshing didn't work, opening a new tab didn't work, and restarting all the docker containers didn't work.

Eventually if I waited a while some content loaded, but most did not. The server status and version fluctuates between offline and online

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

v1.91.4

Version of Immich Mobile App

v1.91.4

Platform with the issue

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    user: 1000:1001
    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
    env_file:
      - .env
    ports:
      - "2283:3001"
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    user: 1000:1001
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.yml
    #   service: hwaccel
    command: [ "start.sh", "microservices" ]
    volumes:
      - /disks/storage/immich/volumes/geocoding:/usr/src/app/.reverse-geocoding-dump
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    user: 1000:1001
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - /disks/storage/immich/volumes/model-cache:/cache
    env_file:
      - .env
    restart: always

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

  database:
    user: 1000:1001
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.1.11
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - /disks/storage/immich/volumes/pgdata:/var/lib/postgresql/data
    restart: always

Your .env content

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

PUID=1000
GUID=1001

# The location where your uploaded files are stored
UPLOAD_LOCATION=/disks/storage/immich/library

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

# Connection secrets for postgres and typesense. You should change these to random passwords
TYPESENSE_API_KEY=...
DB_PASSWORD=...

TZ=America/New_York

# 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

Not sure if there's a specific repo because I can't get out of this state to get back into it.

Additional information

I'm waiting (a very long time) for the admin page to load so I can change the log settings and see if anything is happening there.

eygraber commented 11 months ago

The mobile app seems to be fine.

mertalev commented 11 months ago

Could you share the server logs?

mertalev commented 11 months ago

Hmm, the most relevant change in 1.91.4 seems to be #5829. cc @jrasm91

eygraber commented 11 months ago

There doesn't seem to be anything useful in the server logs.

I restarted again and everything went back to normal.

My first thought was #5829 but aside from files not showing up, the UI is very slow and laggy.

It's possible that this is getting caused by opening multiple tabs and doing some actions. I just got it to happen again by doing that, and then this appeared in the browser console:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'href')
    at 18.141b9aa8.js:1:46940
    at start.4983a0cc.js:1:15986
    at Array.forEach (<anonymous>)
    at ce (start.4983a0cc.js:1:15975)
01:29:16.270 websocket.2a2ae4b2.js:1 WebSocket connection to 'wss://.../api/socket.io/?EIO=4&transport=websocket&sid=yV5OYN9_7YL2bUaSAAAi' failed: 
doOpen @ websocket.2a2ae4b2.js:1

yV5OYN9_7YL2bUaSAAAi doesn't show up in CommunicationRepository server logs.

eygraber commented 11 months ago

I'm pretty sure it's related to having multiple tabs open. When I close all the tabs except for one it works, and shortly after I open 3-5 tabs it starts to have problems again.

hrdl-github commented 11 months ago

Possibly unrelated, but URL-based album shares seem to be broken, too. Downgrading to 1.91.3 and 1.91.2 did not fix the issue and there are no server logs.

alextran1502 commented 11 months ago

Can this behavior be reproducible over localIP?

hrdl-github commented 11 months ago

In my possibly unrelated case, yes. Note that I don't use the docker image, but the AUR package https://aur.archlinux.org/packages/immich-server .

alextran1502 commented 11 months ago

@hrdl-github what do you mean by URL-based album shares?

hrdl-github commented 11 months ago

In the user interface this is called "shared links", which for me are resulting in an empty HTTP response at the moment, @alextran1502 .

alextran1502 commented 11 months ago

@hrdl-github Hmm I cannot reproduce it https://demo.immich.app/sharing/sharedlinks

hrdl-github commented 11 months ago

I'll take a closer look at this this weekend and report back.

hrdl-github commented 11 months ago

curl https://demo.immich.app/albums/df64ca3f-cb80-4001-99aa-05f69a176c2c returns a non-empty result. Opening the link using a browser causes the SPA to be loaded. On my installation selecting this seems to be broken: instead of the SPA I get an empty reply.

alextran1502 commented 11 months ago

@hrdl-github Since you are using a different installation method, I am not sure I can help you much here

hrdl-github commented 11 months ago

You're right, what I reported was a distribution error. ed4358741ebf8d9a5098bad31ec809f7df51e81a introduces a new path /usr/src/app/www/index.html, which doesn't exist in the AUR package. The error is masked by 81603fddc8065e0f30e2ce41ce919f3564840d78, which produces a line in the log that I had overlooked.

eygraber commented 11 months ago

@alextran1502 sorry for the delay.

I browsed around, making changes to albums, faces, people, etc... in one tab for a while with no issues. Then I started opening multiple tabs and after a few minutes was able to repro. I can repro using local IP as well.

Closing all of the tabs except one and then refreshing a few times got it back to normal. Except nothing was loading in the albums page on local IP even after restarting the server (using my domain works). I can load a specific album though.

eygraber commented 11 months ago

I can consistently repro this by opening up 5+ tabs at once.

jrasm91 commented 11 months ago

Hmm that is interesting especially if it happens over local IP.

Might be worth trying to reproduce locally.