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

[BUG] Login screen shown if server is unreachable #4850

Closed
1 of 3 tasks
opbod opened this issue Nov 5, 2023 · 6 comments
Closed
1 of 3 tasks

[BUG] Login screen shown if server is unreachable #4850

opbod opened this issue Nov 5, 2023 · 6 comments

Comments

@opbod
Copy link
Contributor

opbod commented Nov 5, 2023

The bug

Cannot browse pics using the app if Immich server is unreachable. I'm using Immich behind a VPN on my phone.

Expected that #3279 would fix, but it doesn't.

The OS that Immich Server is running on

Ubuntu LTS

Version of Immich Server

v1.84.0

Version of Immich Mobile App

v1.84.0

Platform with the issue

  • Server
  • Web
  • Mobile

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:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    restart: always

  immich-microservices:
    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:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    restart: always

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

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

  typesense:
    container_name: immich_typesense
    image: typesense/typesense:0.24.1@sha256:9bcff2b829f12074426ca044b56160ca9d777a0c488303469143dd9f8259d4dd
    environment:
      - TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
      - TYPESENSE_DATA_DIR=/data
      # remove this to get debug messages
      - GLOG_minloglevel=1
    volumes:
      - tsdata:/data
    restart: always

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

  database:
    container_name: immich_postgres
    image: postgres:14-alpine@sha256:28407a9961e76f2d285dc6991e8e48893503cc3836a4755bbc2d40bcc272a441
    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

  immich-proxy:
    container_name: immich_proxy
    image: ghcr.io/immich-app/immich-proxy:${IMMICH_VERSION:-release}
    environment:
      # Make sure these values get passed through from the env file
      - IMMICH_SERVER_URL
      - IMMICH_WEB_URL
    ports:
      - 2283:8080
    depends_on:
      - immich-server
      - immich-web
    restart: always

volumes:
  pgdata:
  model-cache:
  tsdata:

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=./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=xxx
DB_PASSWORD=xxx

# 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. Take a few pictures using an Android phone
2. Ensure Immich is unreachable (e.g. turn off VPN towards Immich server)
3. Open Immich; try to browse newly created pictures
4. After a second or so, Immich will show the login screen and pictures can no longer be browsed

Additional information

No response

@opbod opbod added bug labels Nov 5, 2023
@deiop
Copy link

deiop commented Nov 6, 2023

Can confirm. Same here

@traktuner
Copy link
Contributor

traktuner commented Nov 22, 2023

Glad I found this issue before opening a new one.
I have that problem on multiple iOS devices for many months now, since I/we use Immich (since 1.75).
There is no reproduction scenario afaik.
Sometimes, a user on my Immich instance opens the app, and the login screen is shown.
Then, when you force-close the app and open Immich again, you're logged in and the timeline is shown as it should be.
So the app really is still logged in but maybe there was some tiny connection issue in the background and the app thinks it's logged out/offline.
I get those reports from family members on a weekly basis - they are not that familiar with those "advances swipe gestures" on iOS to force-close apps, so it's getting more and more exausting, also I always get the question why this happens, and I have no answer to that...
Immich is behind a reverse proxy and accessible over the internet (without Cloudflare).
We see the issue on the local network and over the internet very randomly.

@alextran1502 Is there anything I/we can do to locate th bug more easily or do you already know the root cause of that issue?
Maybe it's as easy as putting more retry-routines, a more generous gace-period while validating access,... into the app?
Thank you very much for looking into this!

@traktuner
Copy link
Contributor

Correction: I guess I know how to reproduce that issue.
Whenever Immich is performing a background task, and - for instance - the Immich server is being updated in the background - the app will show the login screen, also if the server was not reachable for a very short time.
During that time, Immich iOS logs: ApiException 502: <!DOCTYPE html>
Force-quitting and re-opening Immich resolves that, no login required of course.

@traktuner
Copy link
Contributor

traktuner commented Nov 25, 2023

New data point. NAS rebooted. Opened Immich about 30 minutes after Immich resumed operation and was accessible via web without issues:

Catch all error: ApiException 400: HTTP connection failed: GET /album (Inner exception: Bad file descriptor)

#0      IOClient.send (package:http/src/io_client.dart:90)
<asynchronous suspension>
#1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:93)
<asynchronous suspension>
#2      ApiClient.invokeAPI (package:openapi/api_client.dart:101)
<asynchronous suspension>
#3      AlbumApi.getAllAlbums (package:openapi/api/album_api.dart:371)
<asynchronous suspension>
#4      AlbumService.refreshRemoteAlbums (package:immich_mobile/modules/album/services/album.service.dart:154)
<asynchronous suspension>
#5      Future.wait.<anonymous closure> (dart:async/future.dart:525)
<asynchronous suspension>
 - ApiException 400: HTTP connection failed: GET /album (Inner exception: Bad file descriptor)

#0      IOClient.send (package:http/src/io_client.dart:90)
<asynchronous suspension>
#1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:93)
<asynchronous suspension>
#2      ApiClient.invokeAPI (package:openapi/api_client.dart:101)
<asynchronous suspension>
#3      AlbumApi.getAllAlbums (package:openapi/api/album_api.dart:371)
<asynchronous suspension>
#4      AlbumService.refreshRemoteAlbums (package:immich_mobile/modules/album/services/album.service.dart:154)
<asynchronous suspension>
#5      Future.wait.<anonymous closure> (dart:async/future.dart:525)
<asynchronous suspension>


#0      ApiClient.invokeAPI (package:openapi/api_client.dart:125)
<asynchronous suspension>
#1      AlbumApi.getAllAlbums (package:openapi/api/album_api.dart:371)
<asynchronous suspension>
#2      AlbumService.refreshRemoteAlbums (package:immich_mobile/modules/album/services/album.service.dart:154)
<asynchronous suspension>
#3      Future.wait.<anonymous closure> (dart:async/future.dart:525)
<asynchronous suspension>

@traktuner
Copy link
Contributor

Also there are those 400 api errors for GET /assets
With likely the same error log output

@opbod
Copy link
Contributor Author

opbod commented Feb 28, 2024

Tested and confirmed as fixed by #7383.

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

3 participants