🐛 Bug Report: Application exit unexpectly when acquire lock failed #626

Open
opened 2026-02-04 20:41:13 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @helloworlde on GitHub (Jan 26, 2026).

Reproduction steps

  • docker-compose.yml
services:
  pocket-id:
    image: ghcr.io/pocket-id/pocket-id
    container_name: pocketid
    hostname: pocketid
    restart: unless-stopped
    env_file: .env
    ports:
      - 1411:1411
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - "./data:/app/data"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    healthcheck:
      test: [ "CMD", "/app/pocket-id", "healthcheck" ]
      interval: 1m30s
      timeout: 5s
      retries: 5
      start_period: 10s
  • .env
APP_URL=https://pocket.my.domain
TRUST_PROXY=true
MAXMIND_LICENSE_KEY=
PUID=1000
PGID=1000
DB_PROVIDER=postgres
DB_CONNECTION_STRING=postgres://user:pass@pg:5433/pocketid?sslmode=disable
ANALYTICS_DISABLED=true
GEOLITE_DB_PATH=data/GeoLite2-City.mmdb
LOG_LEVEL=warn
LOG_JSON=true
ALLOW_USER_SIGNUPS=withToken
ENCRYPTION_KEY=my-key

UI_CONFIG_DISABLED=false
APP_NAME=Pocket ID
SESSION_DURATION=3600
  • error log
pocketid  | {"time":"2026-01-25T16:54:09.615773175+08:00","level":"ERROR","msg":"Failed to run pocket-id","app":"pocket-id","version":"2.2.0","error":"failed to acquire application lock: lock is already held by another process"}

....

pocketid  | {"time":"2026-01-26T22:31:49.424192681+08:00","level":"ERROR","msg":"Error during graceful shutdown","app":"pocket-id","version":"2.2.0","error":"failed to release application lock: release lock failed: timeout: context deadline exceeded"}
pocketid  | {"time":"2026-01-26T22:31:49.42424068+08:00","level":"ERROR","msg":"Failed to run pocket-id","app":"pocket-id","version":"2.2.0","error":"failed to run services: renew lock: lock renewal failed: timeout: context deadline exceeded"}

Expected behavior

Application run correctly

Actual Behavior

Application exit, and db/docker/network works well.

Pocket ID Version

2.2.0

Database

Postgres 16.7

OS and Environment

Docker on ubuntu 24.10 in PVE LXC

Log Output

No response

Originally created by @helloworlde on GitHub (Jan 26, 2026). ### Reproduction steps - docker-compose.yml ```yml services: pocket-id: image: ghcr.io/pocket-id/pocket-id container_name: pocketid hostname: pocketid restart: unless-stopped env_file: .env ports: - 1411:1411 volumes: - /etc/localtime:/etc/localtime:ro - "./data:/app/data" extra_hosts: - "host.docker.internal:host-gateway" healthcheck: test: [ "CMD", "/app/pocket-id", "healthcheck" ] interval: 1m30s timeout: 5s retries: 5 start_period: 10s ``` - .env ```env APP_URL=https://pocket.my.domain TRUST_PROXY=true MAXMIND_LICENSE_KEY= PUID=1000 PGID=1000 DB_PROVIDER=postgres DB_CONNECTION_STRING=postgres://user:pass@pg:5433/pocketid?sslmode=disable ANALYTICS_DISABLED=true GEOLITE_DB_PATH=data/GeoLite2-City.mmdb LOG_LEVEL=warn LOG_JSON=true ALLOW_USER_SIGNUPS=withToken ENCRYPTION_KEY=my-key UI_CONFIG_DISABLED=false APP_NAME=Pocket ID SESSION_DURATION=3600 ``` - error log ```golang pocketid | {"time":"2026-01-25T16:54:09.615773175+08:00","level":"ERROR","msg":"Failed to run pocket-id","app":"pocket-id","version":"2.2.0","error":"failed to acquire application lock: lock is already held by another process"} .... pocketid | {"time":"2026-01-26T22:31:49.424192681+08:00","level":"ERROR","msg":"Error during graceful shutdown","app":"pocket-id","version":"2.2.0","error":"failed to release application lock: release lock failed: timeout: context deadline exceeded"} pocketid | {"time":"2026-01-26T22:31:49.42424068+08:00","level":"ERROR","msg":"Failed to run pocket-id","app":"pocket-id","version":"2.2.0","error":"failed to run services: renew lock: lock renewal failed: timeout: context deadline exceeded"} ``` ### Expected behavior Application run correctly ### Actual Behavior Application exit, and db/docker/network works well. ### Pocket ID Version 2.2.0 ### Database Postgres 16.7 ### OS and Environment Docker on ubuntu 24.10 in PVE LXC ### Log Output _No response_
Author
Owner

@l-maciej commented on GitHub (Feb 1, 2026):

I have same bug with the sqlite db version 2.20

 Feb  1 19:49:58 INF Released application lock app=pocket-id version=2.2.0 process_id=1 host_id=pocket-id-0                                                                                                                        
 Feb  1 19:49:58 ERR Failed to run pocket-id app=pocket-id version=2.2.0 error="failed to run services: renew lock: lock ownership lost"

Using Kubernetes and community chart.

@l-maciej commented on GitHub (Feb 1, 2026): I have same bug with the sqlite db version 2.20 ``` Feb 1 19:49:58 INF Released application lock app=pocket-id version=2.2.0 process_id=1 host_id=pocket-id-0 Feb 1 19:49:58 ERR Failed to run pocket-id app=pocket-id version=2.2.0 error="failed to run services: renew lock: lock ownership lost" ``` Using Kubernetes and community chart.
Author
Owner

@0x2142 commented on GitHub (Feb 2, 2026):

Also seeing the same here running v2.2.0 & sqlite DB - single instance on docker.

App is stopping / restarting about 4-6 times a day now due to lock issues, which then is interrupting auth flow while it's down. Before the new locking mechanism was added, this was super stable.

Feb  2 12:43:24 INF Job scheduler shut down app=pocket-id version=2.2.0
Feb  2 12:43:24 INF Released application lock app=pocket-id version=2.2.0 process_id=1 host_id=39be0f337aeb
Feb  2 12:43:24 ERR Failed to run pocket-id app=pocket-id version=2.2.0 error="failed to run services: renew lock: lock ownership lost"
@0x2142 commented on GitHub (Feb 2, 2026): Also seeing the same here running v2.2.0 & sqlite DB - single instance on docker. App is stopping / restarting about 4-6 times a day now due to lock issues, which then is interrupting auth flow while it's down. Before the new locking mechanism was added, this was super stable. ```text Feb 2 12:43:24 INF Job scheduler shut down app=pocket-id version=2.2.0 Feb 2 12:43:24 INF Released application lock app=pocket-id version=2.2.0 process_id=1 host_id=39be0f337aeb Feb 2 12:43:24 ERR Failed to run pocket-id app=pocket-id version=2.2.0 error="failed to run services: renew lock: lock ownership lost" ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id#626