[Bug]: Stale lock after Scan #400

Closed
opened 2026-04-24 23:07:52 +02:00 by adam · 17 comments
Owner

Originally created by @plague-doctor on GitHub (Jun 1, 2022).

Describe the issue

[2022-06-01T03:06:29.087Z]  INFO: [Scanner] Starting library scan lscan_3if6d48una7mun367q for Polskie
[2022-06-01T03:06:30.031Z] ERROR: [DB] Update entity user Failed: Error: Lock file is already being held
[2022-06-01T03:06:31.344Z] ERROR: [DB] Update entity user Failed: Error: Lock file is already being held
[2022-06-01T03:06:47.228Z] ERROR: [DB] Library Items update failed Error: Lock file is already being held
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
[2022-06-01T03:07:14.600Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}

Steps to reproduce the issue

  1. Go to Libraries
  2. Click "Scan" or "Force Re-Scan"

Audiobookshelf version

v2.0.18 docker

How are you running audiobookshelf?

Docker

Originally created by @plague-doctor on GitHub (Jun 1, 2022). ### Describe the issue ``` [2022-06-01T03:06:29.087Z] INFO: [Scanner] Starting library scan lscan_3if6d48una7mun367q for Polskie [2022-06-01T03:06:30.031Z] ERROR: [DB] Update entity user Failed: Error: Lock file is already being held [2022-06-01T03:06:31.344Z] ERROR: [DB] Update entity user Failed: Error: Lock file is already being held [2022-06-01T03:06:47.228Z] ERROR: [DB] Library Items update failed Error: Lock file is already being held Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } [2022-06-01T03:07:14.600Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } ``` ### Steps to reproduce the issue 1. Go to Libraries 2. Click "Scan" or "Force Re-Scan" ### Audiobookshelf version v2.0.18 docker ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:07:52 +02:00
adam closed this issue 2026-04-24 23:07:53 +02:00
Author
Owner

@plague-doctor commented on GitHub (Jun 1, 2022):

Not happy with the latest release... I am unable to properly scan my books anymore...
I get this error every time I click Scan or Force Re-Scan:

[2022-06-01T06:00:07.632Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held
[2022-06-01T06:00:17.668Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held
[2022-06-01T06:00:29.858Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held
[2022-06-01T06:00:41.653Z] ERROR: [DB] Failed to insert series Error: Lock file is already being held
    at /node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/config/series/data/data.0.json'
}
[2022-06-01T06:00:51.633Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held
@plague-doctor commented on GitHub (Jun 1, 2022): Not happy with the latest release... I am unable to properly scan my books anymore... I get this error every time I click **Scan** or **Force Re-Scan**: ``` [2022-06-01T06:00:07.632Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held [2022-06-01T06:00:17.668Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held [2022-06-01T06:00:29.858Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held [2022-06-01T06:00:41.653Z] ERROR: [DB] Failed to insert series Error: Lock file is already being held at /node_modules/proper-lockfile/lib/lockfile.js:68:47 at callback (/node_modules/graceful-fs/polyfills.js:306:20) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ELOCKED', file: '/config/series/data/data.0.json' } [2022-06-01T06:00:51.633Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held ```
Author
Owner

@advplyr commented on GitHub (Jun 1, 2022):

Haven't heard anyone else report this with the new release. When you reset the server and run a scan can I see the logs before the files get locked?

@advplyr commented on GitHub (Jun 1, 2022): Haven't heard anyone else report this with the new release. When you reset the server and run a scan can I see the logs before the files get locked?
Author
Owner

@plague-doctor commented on GitHub (Jun 1, 2022):

Sure.

starting...

> audiobookshelf@2.0.18 start
> node index.js
Config /config /metadata
[2022-06-01T19:10:04.212Z]  INFO: === Starting Server ===
[2022-06-01T19:10:04.212Z]  INFO: [Server] Init v2.0.18
[2022-06-01T19:10:04.304Z]  INFO: [DB] 4 Users Loaded
[2022-06-01T19:10:04.305Z]  INFO: [DB] 2 Libraries Loaded
[2022-06-01T19:10:04.305Z]  INFO: [DB] 1 Collections Loaded
[2022-06-01T19:10:04.307Z]  INFO: [DB] 310 Authors Loaded
[2022-06-01T19:10:04.307Z]  INFO: [DB] 165 Series Loaded
[2022-06-01T19:10:04.314Z]  INFO: [DB] 46 Library Items Loaded
[2022-06-01T19:10:04.573Z]  INFO: [Server] Purged 105 unused library item metadata
[2022-06-01T19:10:04.600Z]  WARN: [BackupManager] Backup appears to be corrupted: /metadata/backups/2022-04-02T0100.audiobookshelf
[2022-06-01T19:10:04.775Z]  INFO: [BackupManager] 2 Backups Found
[2022-06-01T19:10:04.783Z]  INFO: [LogManager] Init current daily log filename: 2022-06-01.txt
[2022-06-01T19:10:04.787Z]  INFO: [Watcher] Initializing watcher for "Polskie".
[2022-06-01T19:10:04.789Z]  INFO: [Watcher] Initializing watcher for "English".
[2022-06-01T19:10:04.799Z]  INFO: Listening on http://0.0.0.0:80
[2022-06-01T19:10:05.085Z]  INFO: [Watcher] "English" Ready
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
[2022-06-01T19:10:07.220Z]  INFO: [Watcher] "Polskie" Ready
[2022-06-01T19:10:23.645Z]  INFO: [Server] Socket Connected bYSpxw5zkfJRUnB8AAAB
[2022-06-01T19:10:33.650Z] ERROR: [DB] Update entity user Failed: Error: Lock file is already being held
[2022-06-01T19:13:33.021Z] ERROR: [DB] Update entity settings Failed: Error: Lock file is already being held

scanning:

{"timestamp":"2022-06-01T19:14:44.631Z","message":"[Scanner] Starting library scan lscan_mehw3gy3po8xv3jw0p for Polskie","levelName":"INFO","level":2}
{"timestamp":"2022-06-01T19:15:03.892Z","message":"[BookMetadata] Key updated series [object Object]","levelName":"DEBUG","level":1}
{"timestamp":"2022-06-01T19:15:04.413Z","message":"[BookMetadata] Key updated series [object Object]","levelName":"DEBUG","level":1}
{"timestamp":"2022-06-01T19:15:05.546Z","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_mcoj1acd2ngx283y95/metadata.abs\"","levelName":"DEBUG","level":1}
{"timestamp":"2022-06-01T19:15:05.547Z","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_9dtngrg5zoiaelewa3/metadata.abs\"","levelName":"DEBUG","level":1}
{"timestamp":"2022-06-01T19:15:14.167Z","message":"[DB] Library Items update failed Error: Lock file is already being held","levelName":"ERROR","level":4}
{"timestamp":"2022-06-01T19:15:14.235Z","message":"[BookMetadata] Key updated series [object Object]","levelName":"DEBUG","level":1}
{"timestamp":"2022-06-01T19:15:14.892Z","message":"[BookMetadata] Key updated series [object Object]","levelName":"DEBUG","level":1}
{"timestamp":"2022-06-01T19:15:15.966Z","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_kwi362in0c2bsx3ve0/metadata.abs\"","levelName":"DEBUG","level":1}
{"timestamp":"2022-06-01T19:15:15.966Z","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_hx1a5ie5hw293dndf5/metadata.abs\"","levelName":"DEBUG","level":1}
{"timestamp":"2022-06-01T19:15:24.652Z","message":"[DB] Library Items update failed Error: Lock file is already being held","levelName":"ERROR","level":4}
[...]
@plague-doctor commented on GitHub (Jun 1, 2022): Sure. starting... ``` > audiobookshelf@2.0.18 start > node index.js Config /config /metadata [2022-06-01T19:10:04.212Z] INFO: === Starting Server === [2022-06-01T19:10:04.212Z] INFO: [Server] Init v2.0.18 [2022-06-01T19:10:04.304Z] INFO: [DB] 4 Users Loaded [2022-06-01T19:10:04.305Z] INFO: [DB] 2 Libraries Loaded [2022-06-01T19:10:04.305Z] INFO: [DB] 1 Collections Loaded [2022-06-01T19:10:04.307Z] INFO: [DB] 310 Authors Loaded [2022-06-01T19:10:04.307Z] INFO: [DB] 165 Series Loaded [2022-06-01T19:10:04.314Z] INFO: [DB] 46 Library Items Loaded [2022-06-01T19:10:04.573Z] INFO: [Server] Purged 105 unused library item metadata [2022-06-01T19:10:04.600Z] WARN: [BackupManager] Backup appears to be corrupted: /metadata/backups/2022-04-02T0100.audiobookshelf [2022-06-01T19:10:04.775Z] INFO: [BackupManager] 2 Backups Found [2022-06-01T19:10:04.783Z] INFO: [LogManager] Init current daily log filename: 2022-06-01.txt [2022-06-01T19:10:04.787Z] INFO: [Watcher] Initializing watcher for "Polskie". [2022-06-01T19:10:04.789Z] INFO: [Watcher] Initializing watcher for "English". [2022-06-01T19:10:04.799Z] INFO: Listening on http://0.0.0.0:80 [2022-06-01T19:10:05.085Z] INFO: [Watcher] "English" Ready Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } [2022-06-01T19:10:07.220Z] INFO: [Watcher] "Polskie" Ready [2022-06-01T19:10:23.645Z] INFO: [Server] Socket Connected bYSpxw5zkfJRUnB8AAAB [2022-06-01T19:10:33.650Z] ERROR: [DB] Update entity user Failed: Error: Lock file is already being held [2022-06-01T19:13:33.021Z] ERROR: [DB] Update entity settings Failed: Error: Lock file is already being held ``` scanning: ``` {"timestamp":"2022-06-01T19:14:44.631Z","message":"[Scanner] Starting library scan lscan_mehw3gy3po8xv3jw0p for Polskie","levelName":"INFO","level":2} {"timestamp":"2022-06-01T19:15:03.892Z","message":"[BookMetadata] Key updated series [object Object]","levelName":"DEBUG","level":1} {"timestamp":"2022-06-01T19:15:04.413Z","message":"[BookMetadata] Key updated series [object Object]","levelName":"DEBUG","level":1} {"timestamp":"2022-06-01T19:15:05.546Z","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_mcoj1acd2ngx283y95/metadata.abs\"","levelName":"DEBUG","level":1} {"timestamp":"2022-06-01T19:15:05.547Z","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_9dtngrg5zoiaelewa3/metadata.abs\"","levelName":"DEBUG","level":1} {"timestamp":"2022-06-01T19:15:14.167Z","message":"[DB] Library Items update failed Error: Lock file is already being held","levelName":"ERROR","level":4} {"timestamp":"2022-06-01T19:15:14.235Z","message":"[BookMetadata] Key updated series [object Object]","levelName":"DEBUG","level":1} {"timestamp":"2022-06-01T19:15:14.892Z","message":"[BookMetadata] Key updated series [object Object]","levelName":"DEBUG","level":1} {"timestamp":"2022-06-01T19:15:15.966Z","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_kwi362in0c2bsx3ve0/metadata.abs\"","levelName":"DEBUG","level":1} {"timestamp":"2022-06-01T19:15:15.966Z","message":"[LibraryItem] Success saving abmetadata to \"/metadata/items/li_hx1a5ie5hw293dndf5/metadata.abs\"","levelName":"DEBUG","level":1} {"timestamp":"2022-06-01T19:15:24.652Z","message":"[DB] Library Items update failed Error: Lock file is already being held","levelName":"ERROR","level":4} [...] ```
Author
Owner

@plague-doctor commented on GitHub (Jun 1, 2022):

Not even "Remove all library items" work...

[2022-06-01T19:39:02.767Z]  INFO: Removing all Library Items
[2022-06-01T19:39:11.403Z] ERROR: [DB] Failed to drop library items db Error: Lock file is already being held
    at /node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/config/libraryItems/data/data.0.json'
}

I've got "Scanner prefer OPF metadata" ON if this is an important note...

@plague-doctor commented on GitHub (Jun 1, 2022): Not even "Remove all library items" work... ``` [2022-06-01T19:39:02.767Z] INFO: Removing all Library Items [2022-06-01T19:39:11.403Z] ERROR: [DB] Failed to drop library items db Error: Lock file is already being held at /node_modules/proper-lockfile/lib/lockfile.js:68:47 at callback (/node_modules/graceful-fs/polyfills.js:306:20) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ELOCKED', file: '/config/libraryItems/data/data.0.json' } ``` I've got **"Scanner prefer OPF metadata" ON** if this is an important note...
Author
Owner

@advplyr commented on GitHub (Jun 1, 2022):

Someone did actually have this issue recently running Docker on Windows. To fix the issue they "resolved this by adding privledged: true to the docker-compose.yml"

You will need to go into the /config folder and delete those lock folders manually I think. Making sure the server is spun down before doing that.
This seems to be a permission issue. Can you tell me how you running the docker container and on what OS?

@advplyr commented on GitHub (Jun 1, 2022): Someone did actually have this issue recently running Docker on Windows. To fix the issue they "resolved this by adding `privledged: true` to the docker-compose.yml" You will need to go into the /config folder and delete those lock folders manually I think. Making sure the server is spun down before doing that. This seems to be a permission issue. Can you tell me how you running the docker container and on what OS?
Author
Owner

@plague-doctor commented on GitHub (Jun 1, 2022):

I am sorry @advplyr, but privledged: true is a horrible advise. It is a huge security hole.
Permissions... I don't remember touching the permissions for ABS...
I will nuke the locks and will see.
I run ABS in Docker Swarm mode on Debian, btw.

@plague-doctor commented on GitHub (Jun 1, 2022): I am sorry @advplyr, but `privledged: true` is a horrible advise. It is a huge security hole. Permissions... I don't remember touching the permissions for ABS... I will nuke the locks and will see. I run ABS in Docker Swarm mode on Debian, btw.
Author
Owner

@plague-doctor commented on GitHub (Jun 1, 2022):

Also, what lives in ./metadata/streams? All those output-*.tsfiles? They occupy over 5GB of space. Is that normal?

@plague-doctor commented on GitHub (Jun 1, 2022): Also, what lives in `./metadata/streams`? All those `output-*.ts`files? They occupy over 5GB of space. Is that normal?
Author
Owner

@plague-doctor commented on GitHub (Jun 1, 2022):

Ok, maybe we are finally getting somewhere... I have nuked all but ./config/users in ./config.
Restarted ABS. Lots of those errors:

[2022-06-01T20:06:47.521Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held
    at /node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/config/authors/data/data.1.json'
}
[...]

but what interesting access rights on the files:

ls -lan config/libraryItems

drwxr-xr-x 7 0 1000  12 2022-06-02 06:05 data
drwxr-xr-x 2 0 1000   2 2022-06-02 06:03 tmp
-rw-r--r-- 1 0 1000 349 2022-06-02 06:03 njodb.properties

0:1000? Why root? As per documentation, I can specify AUDIOBOOKSHELF_UID and AUDIOBOOKSHELF_GID... And I have got in my yaml:

    environment:
      - AUDIOBOOKSHELF_UID=1000
      - AUDIOBOOKSHELF_GID=1000

Isn't this a culprit?

@plague-doctor commented on GitHub (Jun 1, 2022): Ok, maybe we are finally getting somewhere... I have nuked all but `./config/users` in `./config`. Restarted ABS. Lots of those errors: ``` [2022-06-01T20:06:47.521Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held at /node_modules/proper-lockfile/lib/lockfile.js:68:47 at callback (/node_modules/graceful-fs/polyfills.js:306:20) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ELOCKED', file: '/config/authors/data/data.1.json' } [...] ``` but what interesting access rights on the files: ``` ls -lan config/libraryItems drwxr-xr-x 7 0 1000 12 2022-06-02 06:05 data drwxr-xr-x 2 0 1000 2 2022-06-02 06:03 tmp -rw-r--r-- 1 0 1000 349 2022-06-02 06:03 njodb.properties ``` 0:1000? Why root? As per documentation, I can specify `AUDIOBOOKSHELF_UID` and `AUDIOBOOKSHELF_GID`... And I have got in my yaml: ``` environment: - AUDIOBOOKSHELF_UID=1000 - AUDIOBOOKSHELF_GID=1000 ``` Isn't this a culprit?
Author
Owner

@advplyr commented on GitHub (Jun 1, 2022):

did you check the access rights on the lock files?

@advplyr commented on GitHub (Jun 1, 2022): did you check the access rights on the lock files?
Author
Owner

@plague-doctor commented on GitHub (Jun 1, 2022):

ok. More to it.

  • Wiped all content of ./config/* (except ./config/users).
  • Wiped all content of ./metadata/*
  • Fixed user for the container (now using user 1000:1000).
ls -lan config/authors/data                 

drwxr-xr-x 7 1000 1000  12 2022-06-02 06:55 .
drwxr-xr-x 4 1000 1000   5 2022-06-02 06:54 ..
drwxr-xr-x 2 1000 1000   2 2022-06-02 07:05 data.0.json.lock
drwxr-xr-x 2 1000 1000   2 2022-06-02 07:05 data.1.json.lock
drwxr-xr-x 2 1000 1000   2 2022-06-02 07:05 data.2.json.lock
drwxr-xr-x 2 1000 1000   2 2022-06-02 07:05 data.3.json.lock
drwxr-xr-x 2 1000 1000   2 2022-06-02 07:05 data.4.json.lock
-rw-r--r-- 1 1000 1000 342 2022-06-02 06:55 data.0.json
-rw-r--r-- 1 1000 1000 350 2022-06-02 06:55 data.1.json
-rw-r--r-- 1 1000 1000 344 2022-06-02 06:55 data.2.json
-rw-r--r-- 1 1000 1000 516 2022-06-02 06:55 data.3.json
-rw-r--r-- 1 1000 1000 694 2022-06-02 06:55 data.4.json

all files have proper 1000:1000 in every single directory.

Starting ABS. Run Scan, and:

[2022-06-01T20:59:53.746Z]  INFO: [Scanner] Starting library scan lscan_6z2lkibvbuprkujlvq for Polskie
[2022-06-01T20:59:58.488Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held
    at /node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/config/authors/data/data.0.json'
}
[2022-06-01T21:00:04.320Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held
[2022-06-01T21:00:11.297Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held
    at /node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/config/authors/data/data.2.json'
}
[2022-06-01T21:00:21.721Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held
    at /node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/config/authors/data/data.0.json'
}
[2022-06-01T21:00:23.848Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held
    at /node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/config/authors/data/data.3.json'
}

It is not an issue with the rights, as container run as user node (UID:GID=1000:1000).

@plague-doctor commented on GitHub (Jun 1, 2022): ok. More to it. - Wiped all content of `./config/*` (except ./config/users). - Wiped all content of `./metadata/*` - Fixed user for the container (now using user `1000:1000`). ``` ls -lan config/authors/data drwxr-xr-x 7 1000 1000 12 2022-06-02 06:55 . drwxr-xr-x 4 1000 1000 5 2022-06-02 06:54 .. drwxr-xr-x 2 1000 1000 2 2022-06-02 07:05 data.0.json.lock drwxr-xr-x 2 1000 1000 2 2022-06-02 07:05 data.1.json.lock drwxr-xr-x 2 1000 1000 2 2022-06-02 07:05 data.2.json.lock drwxr-xr-x 2 1000 1000 2 2022-06-02 07:05 data.3.json.lock drwxr-xr-x 2 1000 1000 2 2022-06-02 07:05 data.4.json.lock -rw-r--r-- 1 1000 1000 342 2022-06-02 06:55 data.0.json -rw-r--r-- 1 1000 1000 350 2022-06-02 06:55 data.1.json -rw-r--r-- 1 1000 1000 344 2022-06-02 06:55 data.2.json -rw-r--r-- 1 1000 1000 516 2022-06-02 06:55 data.3.json -rw-r--r-- 1 1000 1000 694 2022-06-02 06:55 data.4.json ``` all files have proper `1000:1000` in every single directory. Starting ABS. Run Scan, and: ``` [2022-06-01T20:59:53.746Z] INFO: [Scanner] Starting library scan lscan_6z2lkibvbuprkujlvq for Polskie [2022-06-01T20:59:58.488Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held at /node_modules/proper-lockfile/lib/lockfile.js:68:47 at callback (/node_modules/graceful-fs/polyfills.js:306:20) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ELOCKED', file: '/config/authors/data/data.0.json' } [2022-06-01T21:00:04.320Z] ERROR: [DB] Library Items insert failed Error: Lock file is already being held [2022-06-01T21:00:11.297Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held at /node_modules/proper-lockfile/lib/lockfile.js:68:47 at callback (/node_modules/graceful-fs/polyfills.js:306:20) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ELOCKED', file: '/config/authors/data/data.2.json' } [2022-06-01T21:00:21.721Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held at /node_modules/proper-lockfile/lib/lockfile.js:68:47 at callback (/node_modules/graceful-fs/polyfills.js:306:20) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ELOCKED', file: '/config/authors/data/data.0.json' } [2022-06-01T21:00:23.848Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held at /node_modules/proper-lockfile/lib/lockfile.js:68:47 at callback (/node_modules/graceful-fs/polyfills.js:306:20) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ELOCKED', file: '/config/authors/data/data.3.json' } ``` It is not an issue with the rights, as container run as user `node` (UID:GID=1000:1000).
Author
Owner

@advplyr commented on GitHub (Jun 1, 2022):

one way you could test if this is a permissions issue is by using priviledged: true

@advplyr commented on GitHub (Jun 1, 2022): one way you could test if this is a permissions issue is by using `priviledged: true`
Author
Owner

@plague-doctor commented on GitHub (Jun 1, 2022):

Ok @advplyr only for you :-) But trust me, you are doing it wrong...

Escalated privileges. Started. Scan:

> audiobookshelf@2.0.18 start
> node index.js
Config /config /metadata
[2022-06-01T21:26:27.794Z]  INFO: === Starting Server ===
[2022-06-01T21:26:27.795Z]  INFO: [Server] Init v2.0.18
[2022-06-01T21:26:27.821Z]  INFO: [DB] 0 Collections Loaded
[2022-06-01T21:26:27.869Z]  INFO: [DB] 2 Libraries Loaded
[2022-06-01T21:26:27.870Z]  INFO: [DB] 4 Users Loaded
[2022-06-01T21:26:27.871Z]  INFO: [DB] 13 Authors Loaded
[2022-06-01T21:26:27.871Z]  INFO: [DB] 4 Series Loaded
[2022-06-01T21:26:27.875Z]  INFO: [DB] 17 Library Items Loaded
[2022-06-01T21:26:27.898Z]  INFO: [BackupManager] 0 Backups Found
[2022-06-01T21:26:27.898Z]  INFO: [BackupManager] Auto Backups are disabled
[2022-06-01T21:26:27.900Z]  INFO: [LogManager] Init current daily log filename: 2022-06-02.txt
[2022-06-01T21:26:27.904Z]  INFO: [Server] Watcher is disabled
[2022-06-01T21:26:27.913Z]  INFO: Listening on http://0.0.0.0:80
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
Error: Stale lock or attempt to update it after release
    at process.<anonymous> (/server/njodb/index.js:101:37)
    at process.emit (node:events:527:28)
    at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34)
    at process._fatalException (node:internal/process/execution:167:25) {
  code: 'ECOMPROMISED'
}
[2022-06-01T21:26:41.934Z]  INFO: [Server] Socket Connected aywAFb6Erfsf1c1qAAAB
[2022-06-01T21:26:52.104Z] ERROR: [DB] Update entity user Failed: Error: Lock file is already being held
[2022-06-01T21:26:58.355Z]  INFO: [Scanner] Starting library scan lscan_1hvwg0zekr5cl55xhv for Polskie
[2022-06-01T21:27:29.141Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held
    at /node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/config/authors/data/data.3.json'
}
[2022-06-01T21:27:38.739Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held
    at /node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/config/authors/data/data.3.json'
}
@plague-doctor commented on GitHub (Jun 1, 2022): Ok @advplyr only for you :-) But trust me, you are doing it wrong... Escalated privileges. Started. Scan: ``` > audiobookshelf@2.0.18 start > node index.js Config /config /metadata [2022-06-01T21:26:27.794Z] INFO: === Starting Server === [2022-06-01T21:26:27.795Z] INFO: [Server] Init v2.0.18 [2022-06-01T21:26:27.821Z] INFO: [DB] 0 Collections Loaded [2022-06-01T21:26:27.869Z] INFO: [DB] 2 Libraries Loaded [2022-06-01T21:26:27.870Z] INFO: [DB] 4 Users Loaded [2022-06-01T21:26:27.871Z] INFO: [DB] 13 Authors Loaded [2022-06-01T21:26:27.871Z] INFO: [DB] 4 Series Loaded [2022-06-01T21:26:27.875Z] INFO: [DB] 17 Library Items Loaded [2022-06-01T21:26:27.898Z] INFO: [BackupManager] 0 Backups Found [2022-06-01T21:26:27.898Z] INFO: [BackupManager] Auto Backups are disabled [2022-06-01T21:26:27.900Z] INFO: [LogManager] Init current daily log filename: 2022-06-02.txt [2022-06-01T21:26:27.904Z] INFO: [Server] Watcher is disabled [2022-06-01T21:26:27.913Z] INFO: Listening on http://0.0.0.0:80 Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } Error: Stale lock or attempt to update it after release at process.<anonymous> (/server/njodb/index.js:101:37) at process.emit (node:events:527:28) at processEmit [as emit] (/node_modules/signal-exit/index.js:199:34) at process._fatalException (node:internal/process/execution:167:25) { code: 'ECOMPROMISED' } [2022-06-01T21:26:41.934Z] INFO: [Server] Socket Connected aywAFb6Erfsf1c1qAAAB [2022-06-01T21:26:52.104Z] ERROR: [DB] Update entity user Failed: Error: Lock file is already being held [2022-06-01T21:26:58.355Z] INFO: [Scanner] Starting library scan lscan_1hvwg0zekr5cl55xhv for Polskie [2022-06-01T21:27:29.141Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held at /node_modules/proper-lockfile/lib/lockfile.js:68:47 at callback (/node_modules/graceful-fs/polyfills.js:306:20) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ELOCKED', file: '/config/authors/data/data.3.json' } [2022-06-01T21:27:38.739Z] ERROR: [DB] Failed to insert author Error: Lock file is already being held at /node_modules/proper-lockfile/lib/lockfile.js:68:47 at callback (/node_modules/graceful-fs/polyfills.js:306:20) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ELOCKED', file: '/config/authors/data/data.3.json' } ```
Author
Owner

@advplyr commented on GitHub (Jun 2, 2022):

You have to remove the lock files before trying that. Using the privilege will help to identify if it is the issue, doesn't mean you need to keep it that way. I don't have this issue and I don't need to run it as privileged.

@advplyr commented on GitHub (Jun 2, 2022): You have to remove the lock files before trying that. Using the privilege will help to identify if it is the issue, doesn't mean you need to keep it that way. I don't have this issue and I don't need to run it as privileged.
Author
Owner

@plague-doctor commented on GitHub (Jun 2, 2022):

I do remove everything (including lock files and directories in ./config and ./metadata). The only things left untouched are my audiobooks and ./config/users...

@plague-doctor commented on GitHub (Jun 2, 2022): I do remove everything (including lock files and directories in ./config and ./metadata). The only things left untouched are my audiobooks and ./config/users...
Author
Owner

@plague-doctor commented on GitHub (Jun 2, 2022):

I can clearly see the ABS creates the files, and the very same time put the locks on them.
And no - there is no file access issue anymore. The container runs as me - 1000:1000. Unless you hard-code the user, then I don't know.

@plague-doctor commented on GitHub (Jun 2, 2022): I can clearly see the ABS creates the files, and the very same time put the locks on them. And no - there is no file access issue anymore. The container runs as me - 1000:1000. Unless you hard-code the user, then I don't know.
Author
Owner

@advplyr commented on GitHub (Jun 2, 2022):

The only thing I can think to suggest now is to spin up a completely separate abs server using all different volume maps.

@advplyr commented on GitHub (Jun 2, 2022): The only thing I can think to suggest now is to spin up a completely separate abs server using all different volume maps.
Author
Owner

@plague-doctor commented on GitHub (Jun 2, 2022):

This was actually a good suggestion. I have bounced the server and suddenly everything started to behave as is should. Docker hick-up? Interesting.
Anyway, thanks for helping me to pin-point this issue...

@plague-doctor commented on GitHub (Jun 2, 2022): This was actually a good suggestion. I have bounced the server and suddenly everything started to behave as is should. Docker hick-up? Interesting. Anyway, thanks for helping me to pin-point this issue...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#400