[Bug]: App crashes the server #194

Closed
opened 2026-04-24 23:00:54 +02:00 by adam · 6 comments
Owner

Originally created by @izyspania on GitHub (Feb 2, 2022).

Describe the issue

When using the android app with an user other than root the server crashes. (it seems whenever the app is asking something from the server the server just crashes)

2022-02-02T14:40:44.937Z] DEBUG: [Server] User Online root
[2022-02-02T14:40:44.942Z] DEBUG: [DB] Updated user: 1 | Selected: 1
[2022-02-02T14:40:44.945Z] DEBUG: [DB] Updated user: 1 | Selected: 1
[2022-02-02T14:40:45.687Z]  INFO: Recieved ping
[2022-02-02T14:40:45.693Z]  INFO: Recieved ping
[2022-02-02T14:40:45.797Z]  INFO: [SOCKET] Socket Connected VltNfc7M4dawNY8TAAAD
[2022-02-02T14:40:45.802Z] DEBUG: [Server] User Online demo
[2022-02-02T14:40:45.806Z] DEBUG: [DB] Updated user: 1 | Selected: 1
[2022-02-02T14:40:47.066Z]  INFO: [SOCKET] Socket Connected ANklg0blYjjYIseUAAAF
[2022-02-02T14:40:47.067Z] DEBUG: [Server] User Online root
[2022-02-02T14:40:47.070Z] DEBUG: [DB] Updated user: 1 | Selected: 1
E:\audiobookshelf\node_modules\njodb\index.js:103
        throw error;
        ^

TypeError: Cannot read properties of null (reading 'ab_k43ez3idypa8jkn1ap')
    at User.syncLocalUserAudiobookData (E:\audiobookshelf\server\objects\User.js:342:25)
    at E:\audiobookshelf\server\ApiController.js:365:20
    at Array.forEach (<anonymous>)
    at ApiController.syncUserAudiobookData (E:\audiobookshelf\server\ApiController.js:355:19)
    at Layer.handle [as handle_request] (E:\audiobookshelf\node_modules\express\lib\router\layer.js:95:5)
    at next (E:\audiobookshelf\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (E:\audiobookshelf\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (E:\audiobookshelf\node_modules\express\lib\router\layer.js:95:5)
    at E:\audiobookshelf\node_modules\express\lib\router\index.js:281:22
    at Function.process_params (E:\audiobookshelf\node_modules\express\lib\router\index.js:335:12)

Steps to reproduce the issue

Audiobookshelf version

last versions

How are you running audiobookshelf?

Built from source

Originally created by @izyspania on GitHub (Feb 2, 2022). ### Describe the issue When using the android app with an user other than root the server crashes. (it seems whenever the app is asking something from the server the server just crashes) ``` 2022-02-02T14:40:44.937Z] DEBUG: [Server] User Online root [2022-02-02T14:40:44.942Z] DEBUG: [DB] Updated user: 1 | Selected: 1 [2022-02-02T14:40:44.945Z] DEBUG: [DB] Updated user: 1 | Selected: 1 [2022-02-02T14:40:45.687Z] INFO: Recieved ping [2022-02-02T14:40:45.693Z] INFO: Recieved ping [2022-02-02T14:40:45.797Z] INFO: [SOCKET] Socket Connected VltNfc7M4dawNY8TAAAD [2022-02-02T14:40:45.802Z] DEBUG: [Server] User Online demo [2022-02-02T14:40:45.806Z] DEBUG: [DB] Updated user: 1 | Selected: 1 [2022-02-02T14:40:47.066Z] INFO: [SOCKET] Socket Connected ANklg0blYjjYIseUAAAF [2022-02-02T14:40:47.067Z] DEBUG: [Server] User Online root [2022-02-02T14:40:47.070Z] DEBUG: [DB] Updated user: 1 | Selected: 1 E:\audiobookshelf\node_modules\njodb\index.js:103 throw error; ^ TypeError: Cannot read properties of null (reading 'ab_k43ez3idypa8jkn1ap') at User.syncLocalUserAudiobookData (E:\audiobookshelf\server\objects\User.js:342:25) at E:\audiobookshelf\server\ApiController.js:365:20 at Array.forEach (<anonymous>) at ApiController.syncUserAudiobookData (E:\audiobookshelf\server\ApiController.js:355:19) at Layer.handle [as handle_request] (E:\audiobookshelf\node_modules\express\lib\router\layer.js:95:5) at next (E:\audiobookshelf\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (E:\audiobookshelf\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (E:\audiobookshelf\node_modules\express\lib\router\layer.js:95:5) at E:\audiobookshelf\node_modules\express\lib\router\index.js:281:22 at Function.process_params (E:\audiobookshelf\node_modules\express\lib\router\index.js:335:12) ``` ### Steps to reproduce the issue 1. ### Audiobookshelf version last versions ### How are you running audiobookshelf? Built from source
adam added the bug label 2026-04-24 23:00:54 +02:00
adam closed this issue 2026-04-24 23:00:54 +02:00
Author
Owner

@izyspania commented on GitHub (Feb 2, 2022):

Full log with a server start:

E:\audiobookshelf>npm run dev

> audiobookshelf@1.6.63 dev
> node index.js

Config E:\audiobookshelf\config E:\audiobookshelf\metadata E:\audiobookshelf\audiobooks
[2022-02-02T14:46:18.285Z]  INFO: === Starting Server ===
[2022-02-02T14:46:18.286Z]  INFO: [Server] Init v1.6.63
[2022-02-02T14:46:18.288Z]  INFO: [DB] 0 Collections Loaded
[2022-02-02T14:46:18.288Z]  INFO: [DB] 0 Authors Loaded
[2022-02-02T14:46:18.307Z]  INFO: [DB] 4 Audiobooks Loaded
[2022-02-02T14:46:18.308Z] DEBUG: Set Log Level to DEBUG
[2022-02-02T14:46:18.308Z]  INFO: [DB] 3 Users Loaded
[2022-02-02T14:46:18.308Z]  INFO: [DB] 1 Libraries Loaded
[2022-02-02T14:46:18.308Z]  INFO: [Db] Root user exists, pw: false
[2022-02-02T14:46:18.310Z]  INFO: [BackupManager] 0 Backups Found
[2022-02-02T14:46:18.310Z]  INFO: [BackupManager] Auto Backups are disabled
[2022-02-02T14:46:18.310Z] DEBUG: Daily Log file found 2022-02-02.txt
[2022-02-02T14:46:18.311Z]  INFO: [LogManager] Init current daily log filename: 2022-02-02.txt
[2022-02-02T14:46:18.312Z] DEBUG: [LogManager] Daily log file already exists - set in Logger
[2022-02-02T14:46:18.315Z] DEBUG: [DailyLog] 2022-02-02: Loaded 1485 Logs
[2022-02-02T14:46:18.316Z]  INFO: [Watcher] Initializing watcher for "Main".
[2022-02-02T14:46:18.316Z] DEBUG: [Watcher] Init watcher for library folder path "E:\audiobookshelf\audiobooks"
[2022-02-02T14:46:18.323Z]  INFO: Running on http://0.0.0.0:3333
[2022-02-02T14:46:18.328Z]  INFO: [Watcher] "Main" Ready
[2022-02-02T14:46:19.390Z]  INFO: [SOCKET] Socket Connected XkP9aDQwzHSL3qjJAAAB
[2022-02-02T14:46:19.392Z] DEBUG: [Server] User Online root
[2022-02-02T14:46:19.397Z] DEBUG: [DB] Updated user: 1 | Selected: 1
[2022-02-02T14:46:21.947Z]  INFO: [SOCKET] Socket Connected _S_mXfVKTfaht1XTAAAD
[2022-02-02T14:46:21.949Z] DEBUG: [Server] User Online root
[2022-02-02T14:46:21.949Z] DEBUG: [Server] Authenticating socket client already has user User {
  id: 'root',
  username: 'root',
  pash: '',
  type: 'root',
  stream: null,
  token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJyb290IiwiaWF0IjoxNjQzODA4OTcwfQ.RDfsZuO0bSEK8c_wxVSJq2POK2Um_jB0RViHskvGPMA',
  isActive: true,
  isLocked: false,
  lastSeen: 1643813181949,
  createdAt: 1643808970747,
  audiobooks: {
    ab_k43ez3idypa8jkn1ap: UserAudiobookData {
      audiobookId: 'ab_k43ez3idypa8jkn1ap',
      totalDuration: 46063.347750999994,
      progress: 0.13,
      currentTime: 5977.09,
      isRead: false,
      lastUpdate: 1643812547167,
      startedAt: 1643811292776,
      finishedAt: null,
      bookmarks: [Array]
    }
  },
  settings: {
    mobileOrderBy: 'addedAt',
    mobileOrderDesc: true,
    mobileFilterBy: 'all',
    orderBy: 'book.title',
    orderDesc: false,
    filterBy: 'all',
    playbackRate: 1,
    bookshelfCoverSize: 120,
    collapseSeries: false
  },
  permissions: {
    download: true,
    update: true,
    delete: true,
    upload: true,
    accessAllLibraries: true
  },
  librariesAccessible: []
}
[2022-02-02T14:46:21.952Z] DEBUG: [Server] User Online root
[2022-02-02T14:46:21.956Z] DEBUG: [DB] Updated user: 1 | Selected: 1
[2022-02-02T14:46:21.959Z] DEBUG: [DB] Updated user: 1 | Selected: 1
[2022-02-02T14:46:43.929Z] DEBUG: [DB] Deleted entity user: 1
[2022-02-02T14:46:53.105Z] DEBUG: [DB] Updated settings: 1 | Selected: 1
[2022-02-02T14:47:17.202Z]  INFO: [ApiController] Purging all cache
[2022-02-02T14:47:27.557Z]  INFO: [Server] Starting Scan
[2022-02-02T14:47:27.558Z]  INFO: [Scanner] Starting library scan lscan_nt5vjg6wjann589s5e for Main
[2022-02-02T14:47:27.848Z] DEBUG: [AudioFileScanner] No audio track re-order required
[2022-02-02T14:47:27.850Z] DEBUG: [AudioFileScanner] No audio track re-order required
[2022-02-02T14:47:27.852Z] DEBUG: [AudioFileScanner] No audio track re-order required
[2022-02-02T14:47:27.853Z] DEBUG: [AudioFileScanner] No audio track re-order required
[2022-02-02T14:47:27.853Z]  INFO: [Scanner] Library scan lscan_nt5vjg6wjann589s5e completed in 0:00.0 | 0 Added | 0 Updated | 0 Missing
[2022-02-02T14:47:27.854Z]  INFO: [Server] Scan complete
[2022-02-02T14:48:01.050Z]  INFO: [SOCKET] Socket Connected bOTXXWDtxr_ebXOOAAAF
[2022-02-02T14:48:01.057Z] DEBUG: [Server] User Online demo
[2022-02-02T14:48:01.061Z] DEBUG: [DB] Updated user: 1 | Selected: 1
E:\audiobookshelf\node_modules\njodb\index.js:103
        throw error;
        ^

TypeError: Cannot read properties of null (reading 'ab_k43ez3idypa8jkn1ap')
    at User.syncLocalUserAudiobookData (E:\audiobookshelf\server\objects\User.js:342:25)
    at E:\audiobookshelf\server\ApiController.js:365:20
    at Array.forEach (<anonymous>)
    at ApiController.syncUserAudiobookData (E:\audiobookshelf\server\ApiController.js:355:19)
    at Layer.handle [as handle_request] (E:\audiobookshelf\node_modules\express\lib\router\layer.js:95:5)
    at next (E:\audiobookshelf\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (E:\audiobookshelf\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (E:\audiobookshelf\node_modules\express\lib\router\layer.js:95:5)
    at E:\audiobookshelf\node_modules\express\lib\router\index.js:281:22
    at Function.process_params (E:\audiobookshelf\node_modules\express\lib\router\index.js:335:12)
@izyspania commented on GitHub (Feb 2, 2022): Full log with a server start: ``` E:\audiobookshelf>npm run dev > audiobookshelf@1.6.63 dev > node index.js Config E:\audiobookshelf\config E:\audiobookshelf\metadata E:\audiobookshelf\audiobooks [2022-02-02T14:46:18.285Z] INFO: === Starting Server === [2022-02-02T14:46:18.286Z] INFO: [Server] Init v1.6.63 [2022-02-02T14:46:18.288Z] INFO: [DB] 0 Collections Loaded [2022-02-02T14:46:18.288Z] INFO: [DB] 0 Authors Loaded [2022-02-02T14:46:18.307Z] INFO: [DB] 4 Audiobooks Loaded [2022-02-02T14:46:18.308Z] DEBUG: Set Log Level to DEBUG [2022-02-02T14:46:18.308Z] INFO: [DB] 3 Users Loaded [2022-02-02T14:46:18.308Z] INFO: [DB] 1 Libraries Loaded [2022-02-02T14:46:18.308Z] INFO: [Db] Root user exists, pw: false [2022-02-02T14:46:18.310Z] INFO: [BackupManager] 0 Backups Found [2022-02-02T14:46:18.310Z] INFO: [BackupManager] Auto Backups are disabled [2022-02-02T14:46:18.310Z] DEBUG: Daily Log file found 2022-02-02.txt [2022-02-02T14:46:18.311Z] INFO: [LogManager] Init current daily log filename: 2022-02-02.txt [2022-02-02T14:46:18.312Z] DEBUG: [LogManager] Daily log file already exists - set in Logger [2022-02-02T14:46:18.315Z] DEBUG: [DailyLog] 2022-02-02: Loaded 1485 Logs [2022-02-02T14:46:18.316Z] INFO: [Watcher] Initializing watcher for "Main". [2022-02-02T14:46:18.316Z] DEBUG: [Watcher] Init watcher for library folder path "E:\audiobookshelf\audiobooks" [2022-02-02T14:46:18.323Z] INFO: Running on http://0.0.0.0:3333 [2022-02-02T14:46:18.328Z] INFO: [Watcher] "Main" Ready [2022-02-02T14:46:19.390Z] INFO: [SOCKET] Socket Connected XkP9aDQwzHSL3qjJAAAB [2022-02-02T14:46:19.392Z] DEBUG: [Server] User Online root [2022-02-02T14:46:19.397Z] DEBUG: [DB] Updated user: 1 | Selected: 1 [2022-02-02T14:46:21.947Z] INFO: [SOCKET] Socket Connected _S_mXfVKTfaht1XTAAAD [2022-02-02T14:46:21.949Z] DEBUG: [Server] User Online root [2022-02-02T14:46:21.949Z] DEBUG: [Server] Authenticating socket client already has user User { id: 'root', username: 'root', pash: '', type: 'root', stream: null, token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJyb290IiwiaWF0IjoxNjQzODA4OTcwfQ.RDfsZuO0bSEK8c_wxVSJq2POK2Um_jB0RViHskvGPMA', isActive: true, isLocked: false, lastSeen: 1643813181949, createdAt: 1643808970747, audiobooks: { ab_k43ez3idypa8jkn1ap: UserAudiobookData { audiobookId: 'ab_k43ez3idypa8jkn1ap', totalDuration: 46063.347750999994, progress: 0.13, currentTime: 5977.09, isRead: false, lastUpdate: 1643812547167, startedAt: 1643811292776, finishedAt: null, bookmarks: [Array] } }, settings: { mobileOrderBy: 'addedAt', mobileOrderDesc: true, mobileFilterBy: 'all', orderBy: 'book.title', orderDesc: false, filterBy: 'all', playbackRate: 1, bookshelfCoverSize: 120, collapseSeries: false }, permissions: { download: true, update: true, delete: true, upload: true, accessAllLibraries: true }, librariesAccessible: [] } [2022-02-02T14:46:21.952Z] DEBUG: [Server] User Online root [2022-02-02T14:46:21.956Z] DEBUG: [DB] Updated user: 1 | Selected: 1 [2022-02-02T14:46:21.959Z] DEBUG: [DB] Updated user: 1 | Selected: 1 [2022-02-02T14:46:43.929Z] DEBUG: [DB] Deleted entity user: 1 [2022-02-02T14:46:53.105Z] DEBUG: [DB] Updated settings: 1 | Selected: 1 [2022-02-02T14:47:17.202Z] INFO: [ApiController] Purging all cache [2022-02-02T14:47:27.557Z] INFO: [Server] Starting Scan [2022-02-02T14:47:27.558Z] INFO: [Scanner] Starting library scan lscan_nt5vjg6wjann589s5e for Main [2022-02-02T14:47:27.848Z] DEBUG: [AudioFileScanner] No audio track re-order required [2022-02-02T14:47:27.850Z] DEBUG: [AudioFileScanner] No audio track re-order required [2022-02-02T14:47:27.852Z] DEBUG: [AudioFileScanner] No audio track re-order required [2022-02-02T14:47:27.853Z] DEBUG: [AudioFileScanner] No audio track re-order required [2022-02-02T14:47:27.853Z] INFO: [Scanner] Library scan lscan_nt5vjg6wjann589s5e completed in 0:00.0 | 0 Added | 0 Updated | 0 Missing [2022-02-02T14:47:27.854Z] INFO: [Server] Scan complete [2022-02-02T14:48:01.050Z] INFO: [SOCKET] Socket Connected bOTXXWDtxr_ebXOOAAAF [2022-02-02T14:48:01.057Z] DEBUG: [Server] User Online demo [2022-02-02T14:48:01.061Z] DEBUG: [DB] Updated user: 1 | Selected: 1 E:\audiobookshelf\node_modules\njodb\index.js:103 throw error; ^ TypeError: Cannot read properties of null (reading 'ab_k43ez3idypa8jkn1ap') at User.syncLocalUserAudiobookData (E:\audiobookshelf\server\objects\User.js:342:25) at E:\audiobookshelf\server\ApiController.js:365:20 at Array.forEach (<anonymous>) at ApiController.syncUserAudiobookData (E:\audiobookshelf\server\ApiController.js:355:19) at Layer.handle [as handle_request] (E:\audiobookshelf\node_modules\express\lib\router\layer.js:95:5) at next (E:\audiobookshelf\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (E:\audiobookshelf\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (E:\audiobookshelf\node_modules\express\lib\router\layer.js:95:5) at E:\audiobookshelf\node_modules\express\lib\router\index.js:281:22 at Function.process_params (E:\audiobookshelf\node_modules\express\lib\router\index.js:335:12) ```
Author
Owner

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

Can you try first logging into the user in the web app and playing an audiobook.
Once you played an audiobook for a few seconds you can close the stream and login to the user in the mobile app.

@advplyr commented on GitHub (Feb 2, 2022): Can you try first logging into the user in the web app and playing an audiobook. Once you played an audiobook for a few seconds you can close the stream and login to the user in the mobile app.
Author
Owner

@izyspania commented on GitHub (Feb 2, 2022):

I just did , same problem. It seems to work with user root but not with other users, The app starts , it shows the main page with the books then the server crashes (even i dont touch it).

Edit: After playing with the user on web and in the app (server crashed several times) now it seems to work , ill test using the app now and see if it will last or ill get another crash.

Edit2: Seems like adding new user then if i dont login and play a book from the web causes the server to crash

@izyspania commented on GitHub (Feb 2, 2022): I just did , same problem. It seems to work with user root but not with other users, The app starts , it shows the main page with the books then the server crashes (even i dont touch it). Edit: After playing with the user on web and in the app (server crashed several times) now it seems to work , ill test using the app now and see if it will last or ill get another crash. Edit2: Seems like adding new user then if i dont login and play a book from the web causes the server to crash
Author
Owner

@advplyr commented on GitHub (Feb 4, 2022):

I think this is fixed now in the latest version v1.6.64

@advplyr commented on GitHub (Feb 4, 2022): I think this is fixed now in the latest version `v1.6.64`
Author
Owner

@izyspania commented on GitHub (Feb 6, 2022):

thanks

@izyspania commented on GitHub (Feb 6, 2022): thanks
Author
Owner

@Thovi98 commented on GitHub (Apr 20, 2022):

Just for reference : I encountered the same issue, with the same workaround to resolve it (https://github.com/advplyr/audiobookshelf/issues/345#issuecomment-1028020903).

@Thovi98 commented on GitHub (Apr 20, 2022): Just for reference : I encountered the same issue, with the same workaround to resolve it (https://github.com/advplyr/audiobookshelf/issues/345#issuecomment-1028020903).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#194