Closed shanyan-wcx closed 3 months ago
Is there anything in crash_logs.txt
?
{"timestamp":"2024-08-10 21:38:53.752","source":"Server.js:170","message":"[Server] Unhandled rejection: TypeError: Cannot use 'in' operator to search for 'readable' in null, promise: Promise {\n
After my testing, I found that when I call the Get an Author's Image API, if there is no image, it will cause the server to crash.
If there is no image, it will not return a 404
I'm experiencing the same behavior, somewhat intermittently
I seem to be getting something similar. After updating from v2.11.0 to v2.12.3 and trying to run a library scan, the page will appear to freeze, and I can observe the following logs over and over. Downgrading to v2.11.0 again does not resolve this issue.
Aug 13 01:29:40 systemd[1]: Started Self-hosted audiobook server for managing and playing audiobooks.
Aug 13 01:29:40 audiobookshelf[2299]: production Config /var/lib/audiobookshelf/config /var/lib/audiobookshelf/metadata
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.968] INFO: === Starting Server ===
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.969] INFO: [Server] Init v2.12.3
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.970] INFO: [Server] Node.js Version: v20.11.1
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.970] INFO: [Server] Platform: linux
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.970] INFO: [Server] Arch: x64
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.979] INFO: [BinaryManager] Found valid binary ffmpeg at ffmpeg
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.979] INFO: [BinaryManager] Updating process.env.FFMPEG_PATH
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.982] INFO: [BinaryManager] Found valid binary ffprobe at ffprobe
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.983] INFO: [BinaryManager] Updating process.env.FFPROBE_PATH
Aug 13 01:29:40 audiobookshelf[2299]: [2024-08-13 01:29:40.983] INFO: [Database] Initializing db at "/var/lib/audiobookshelf/config/absdatabase.sqlite"
Aug 13 01:29:41 audiobookshelf[2299]: [2024-08-13 01:29:41.028] INFO: [Database] Db connection was successful
Aug 13 01:29:41 audiobookshelf[2299]: [2024-08-13 01:29:41.118] INFO: [Database] Db initialized with models: user, library, libraryFolder, book, podcast, podcastEpisode, libraryItem, mediaProgress, series, bookSeries, author, bookAuthor, collection, collectionBook, playlist, playlistMediaItem, device, playbackSession, feed, feedEpisode, setting, customMetadataProvider, mediaItemShare
Aug 13 01:29:41 audiobookshelf[2299]: [2024-08-13 01:29:41.139] INFO: [LogManager] Init current daily log filename: 2024-08-13.txt
Aug 13 01:29:41 audiobookshelf[2299]: [2024-08-13 01:29:41.177] INFO: [BackupManager] 0 Backups Found
Aug 13 01:29:41 audiobookshelf[2299]: [2024-08-13 01:29:41.180] INFO: [BackupManager] Auto Backups are disabled
Aug 13 01:29:41 audiobookshelf[2299]: [2024-08-13 01:29:41.190] INFO: [Watcher] Initializing watcher for "AudioBooks".
Aug 13 01:29:41 audiobookshelf[2299]: Warning: connect.session() MemoryStore is not
Aug 13 01:29:41 audiobookshelf[2299]: designed for a production environment, as it will leak
Aug 13 01:29:41 audiobookshelf[2299]: memory, and will not scale past a single process.
Aug 13 01:29:41 audiobookshelf[2299]: [2024-08-13 01:29:41.197] INFO: Listening on http://0.0.0.0:13378
Aug 13 01:29:41 audiobookshelf[2299]: [2024-08-13 01:29:41.409] INFO: [SocketAuthority] Socket Connected L3EhTp1NqRVsQvluAAAB
Aug 13 01:29:51 audiobookshelf[2299]: [2024-08-13 01:29:51.648] FATAL: [Server] Uncaught exception origin: uncaughtException, error: Error: spawn EPERM
Aug 13 01:29:51 audiobookshelf[2299]: at ChildProcess.spawn (node:internal/child_process:421:11)
Aug 13 01:29:51 audiobookshelf[2299]: at spawn (node:child_process:761:9)
Aug 13 01:29:51 audiobookshelf[2299]: at /usr/share/audiobookshelf/server/libs/fluentFfmpeg/processor.js:148:24
Aug 13 01:29:51 audiobookshelf[2299]: at /usr/share/audiobookshelf/server/libs/fluentFfmpeg/capabilities.js:123:9
Aug 13 01:29:51 audiobookshelf[2299]: at t (/usr/share/audiobookshelf/server/libs/async/index.js:6:1639)
Aug 13 01:29:51 audiobookshelf[2299]: at a (/usr/share/audiobookshelf/server/libs/async/index.js:6:18659)
Aug 13 01:29:51 audiobookshelf[2299]: at /usr/share/audiobookshelf/server/libs/async/index.js:6:2258
Aug 13 01:29:51 audiobookshelf[2299]: at /usr/share/audiobookshelf/server/libs/fluentFfmpeg/capabilities.js:112:18
Aug 13 01:29:51 audiobookshelf[2299]: at n (/usr/share/audiobookshelf/server/libs/async/index.js:6:18591)
Aug 13 01:29:51 audiobookshelf[2299]: at a (/usr/share/audiobookshelf/server/libs/async/index.js:6:18674) {
Aug 13 01:29:51 audiobookshelf[2299]: errno: -1,
Aug 13 01:29:51 audiobookshelf[2299]: code: 'EPERM',
Aug 13 01:29:51 audiobookshelf[2299]: syscall: 'spawn'
Aug 13 01:29:51 audiobookshelf[2299]: } (Server.js:164)
Aug 13 01:29:51 audiobookshelf[2299]: node:internal/child_process:421
Aug 13 01:29:51 audiobookshelf[2299]: throw errnoException(err, 'spawn');
Aug 13 01:29:51 audiobookshelf[2299]: ^
Aug 13 01:29:51 audiobookshelf[2299]: Error: spawn EPERM
Aug 13 01:29:51 audiobookshelf[2299]: at ChildProcess.spawn (node:internal/child_process:421:11)
Aug 13 01:29:51 audiobookshelf[2299]: at spawn (node:child_process:761:9)
Aug 13 01:29:51 audiobookshelf[2299]: at /usr/share/audiobookshelf/server/libs/fluentFfmpeg/processor.js:148:24
Aug 13 01:29:51 audiobookshelf[2299]: at /usr/share/audiobookshelf/server/libs/fluentFfmpeg/capabilities.js:123:9
Aug 13 01:29:51 audiobookshelf[2299]: at t (/usr/share/audiobookshelf/server/libs/async/index.js:6:1639)
Aug 13 01:29:51 audiobookshelf[2299]: at a (/usr/share/audiobookshelf/server/libs/async/index.js:6:18659)
Aug 13 01:29:51 audiobookshelf[2299]: at /usr/share/audiobookshelf/server/libs/async/index.js:6:2258
Aug 13 01:29:51 audiobookshelf[2299]: at /usr/share/audiobookshelf/server/libs/fluentFfmpeg/capabilities.js:112:18
Aug 13 01:29:51 audiobookshelf[2299]: at n (/usr/share/audiobookshelf/server/libs/async/index.js:6:18591)
Aug 13 01:29:51 audiobookshelf[2299]: at a (/usr/share/audiobookshelf/server/libs/async/index.js:6:18674) {
Aug 13 01:29:51 audiobookshelf[2299]: errno: -1,
Aug 13 01:29:51 audiobookshelf[2299]: code: 'EPERM',
Aug 13 01:29:51 audiobookshelf[2299]: syscall: 'spawn'
Aug 13 01:29:51 audiobookshelf[2299]: }
Aug 13 01:29:51 audiobookshelf[2299]: Node.js v20.11.1
Aug 13 01:29:51 systemd[1]: audiobookshelf.service: Main process exited, code=exited, status=1/FAILURE
Aug 13 01:29:51 systemd[1]: audiobookshelf.service: Failed with result 'exit-code'.
Aug 13 01:29:51 systemd[1]: audiobookshelf.service: Consumed 1.556s CPU time.
Aug 13 01:29:51 systemd[1]: audiobookshelf.service: Scheduled restart job, restart counter is at 20.
Aug 13 01:29:51 systemd[1]: Stopped Self-hosted audiobook server for managing and playing audiobooks.
Aug 13 01:29:51 systemd[1]: audiobookshelf.service: Consumed 1.556s CPU time.
Aug 13 01:29:51 systemd[1]: Started Self-hosted audiobook server for managing and playing audiobooks.
The restart loop occurs when I connect a new client or switch between library and home a few times.
If I get to the libraries configuration page and try to scan this shows for any new items
Aug 13 01:44:34 audiobookshelf[1487]: [2024-08-13 01:44:34.397] INFO: [LibraryScanner] Starting library scan 42311323-1b7e-4e67-89f5-d69540f7b47a for AudioBooks
Aug 13 01:45:07 audiobookshelf[1487]: [2024-08-13 01:45:07.439] ERROR: [AudioFileScanner] Error: spawn EPERM : "/lib/path1/book.m4b" (AudioFileScanner.js:159)
Aug 13 01:45:07 audiobookshelf[1487]: [2024-08-13 01:45:07.443] ERROR: [AudioFileScanner] Error: spawn EPERM : "/lib/path2/book.m4b" (AudioFileScanner.js:159)
Aug 13 01:45:07 audiobookshelf[1487]: [2024-08-13 01:45:07.445] ERROR: [AudioFileScanner] Error: spawn EPERM : "/lib/path3/book.m4b" (AudioFileScanner.js:159)
Aug 13 01:45:07 audiobookshelf[1487]: [2024-08-13 01:45:07.446] ERROR: [AudioFileScanner] Error: spawn EPERM : "/lib/path4/book.m4b" (AudioFileScanner.js:159)
Aug 13 01:45:07 audiobookshelf[1487]: [2024-08-13 01:45:07.446] INFO: [LibraryScanner] Library scan 42311323-1b7e-4e67-89f5-d69540f7b47a completed in 0:33.0 | 0 Added | 0 Updated | 0 Missing
Aug 13 01:45:07 audiobookshelf[1487]: [2024-08-13 01:45:07.462] INFO: [LibraryController] Scan complete
Instead of Scan I have now selected Match files. which appears to be cycling through all existing books in the library and downloading images. I'll leave that to run while I sleep and see if it clears anything up, but not holding my breath.
I'm getting the same issue, I've recently moved a server off my NAS onto Windows and restored a backup, for whatever reason most of the Author pictures appear as broken images (even though the image files are there). I was going through trashing the broken image, refreshing, and reloading the images fine, but I got to a random one halfway down and on the refresh I got the exact same error as indicated above.
I reproduced it three times in a row scanning the same author (Harlan Ellison if it matters). same error, same full crash. Interestingly it's (so far) only on that one specific author not the other 100+.
There's maybe a dipper issue here, but the crash is easy to reproduce.
/api/authors/{authorid}/image?token={token}
)Our web interface actually checks if the author has an image when creating the <img>
tag (in AuthorImage.vue
):
imgSrc() {
if (!this.imagePath) return null
if (process.env.NODE_ENV !== 'production') {
// Testing
return `http://localhost:3333${this.$config.routerBasePath}/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}`
}
return `/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}`
}
This is why it's not easy to reproduce using the web interface. However the problem does seem to occur in some circumstances, and indicates that sometimes (for reasons I still need to understand better) there's some data mismatch between client and the server.
We need to fix this since the API can (in theory) be called in isolation.
The root cause for the crash is that we don't check that author.imagePath is not null (or that it exists) before we send it to FFMpeg for resizing. I'll send on a fix for that, and I'll also try to understand the data mismatch issues reported above.
Fixed in v2.13.0.
What happened?
The server stops running after a few minutes of startup. It doesn't always happen, but once it does, it will happen continuously
What did you expect to happen?
Server runs stably.
Steps to reproduce the issue
Audiobookshelf version
v2.12.3
How are you running audiobookshelf?
Docker
What OS is your Audiobookshelf server hosted from?
Linux
If the issue is being seen in the UI, what browsers are you seeing the problem on?
Edge
Logs
Additional Notes
No response