mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Bug]: Recurring crash #1780
Closed
opened 2026-04-24 23:58:03 +02:00 by adam
·
19 comments
No Branch/Tag Specified
master
book_tags_genres_dedupe
episode_download_fallback
Issue-4540-SortBy-StartedDate-and-FinishedDate
episode_meta_tagging
fix_authorize_race_condition
redirect_transcode_requests
progress_updated_sort
fix_ereader_socket_event
fix_change_empty_root_password
fix_podcast_session_track_index
fix_set_token
session_modal_user
localize_durations
fix_oidc_create_user
jwt_auth_refactor
fix_scanner_deleting_single_file_books
fix_mediaprogress_updatedat_2
experimental_next_client
podcast_episode_duration
episode-timestamps-clickable
book_author_secondary_sort_title
podcast_useragents
pathexists_user_access
fix_pathexists_join
book_author_secondary_sort
clean_duplicate_mediaprogress
sanitize_html_description
trix_prevent_attachments
check_path_api_fix
fix_mediaprogress_updatedat
increase_express_json_limit
fix_dockerfile_nunicode
search_episodes
audiobook_tools_update
episode_secondary_sorts
hls_stream_url_update
new_session_track_endpoint
audiobook_tools_enhancements
watcher_rescans_update
player_track_tooltip
fix_exclude_prefixes_crash
socket_item_events
fix_podcast_episode_scanner_promise
new_stats_controller
count_cache_for_userpermissions
parsing-opf-v3
validate_migration_files
fix-quick-match-all-crash
fix-chapter-end-sleep-timer
stringify_sequelize_query
remove-col-ambiguity
fix_next_prev_edit_description
details_trim_whitespace
fix_content_url_basepath
fix_logger_fatal
progress_bar_visibility
batch-edit-populate-map-details
feed_generator_updates
bookmark-modal-updates
migrate-library-item-in-scanner
migrate-new-library-items
migrate-podcasts-new-library-item-2
migrate-podcasts-new-library-item
fix-remove-episode-from-playlist
playback-session-use-new-library-item
refactor-library-item
fix-heatmap-caption
feed-episodes-upsert
share-media-player-media-session-api
remove-old-playlist
remove_old_collection_object
plugin-implementation-demo
feed_migration
refactor-feeds-from-item
fix_remove_authors_no_books
v2.17.3-fk-constraints-migration
migrations-first-upgrade
sqlite_2
feature/nuxt-target-server
waveform
sqlite
playlists
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v1.3.3
v1.3.1
v1.2.8
v1.2.6
v1.2.5
v1.2.4
v1.2.1
v1.1.15
v1.1.14
v1.1.13
v1.1.12
v1.1.11
v1.1.10
v1.1.9
v1.1.8
v1.0.0
0.9.61-beta.0
0.9.61-beta
Labels
Clear labels
authentication
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
pull-request
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
Mirrored from GitHub Pull Request
No Label
bug
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
adam (Adam Melkus)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/audiobookshelf#1780
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sveinbjornpalsson on GitHub (Feb 28, 2024).
Describe the issue
I'm not really sure what else I can add except these two things from the log.
Here's the log, the crash is in bold:
2024-02-28 12:53:39.090
INFO
=== Starting Server ===
2024-02-28 12:53:39.091
INFO
[Server] Init v2.8.0
2024-02-28 12:53:39.104
INFO
[Database] Initializing db at "/config/absdatabase.sqlite"
2024-02-28 12:53:39.183
INFO
[Database] Db connection was successful
2024-02-28 12:53:39.379
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
2024-02-28 12:53:40.117
WARN
Removed 1 sessions that were 3 seconds or less
2024-02-28 12:53:40.124
INFO
[LogManager] Removed daily log: 2024-02-21.txt
2024-02-28 12:53:40.125
INFO
[LogManager] Init current daily log filename: 2024-02-28.txt
2024-02-28 12:53:40.222
INFO
[BackupManager] 0 Backups Found
2024-02-28 12:53:40.223
INFO
[BackupManager] Auto Backups are disabled
2024-02-28 12:53:40.248
INFO
[Watcher] Initializing watcher for "Fiction".
2024-02-28 12:53:40.251
INFO
[Watcher] Initializing watcher for "Podcasts".
2024-02-28 12:53:40.252
INFO
[Watcher] Initializing watcher for "Comedy".
2024-02-28 12:53:40.252
INFO
[Watcher] Initializing watcher for "non-fiction".
2024-02-28 12:53:40.252
INFO
[Watcher] Initializing watcher for "History & Biography".
2024-02-28 12:53:40.265
INFO
Listening on port :80
2024-02-28 12:53:40.381
INFO
[Watcher] "Podcasts" Ready
2024-02-28 12:53:40.770
INFO
[Watcher] "Comedy" Ready
2024-02-28 12:53:40.940
INFO
[Watcher] "non-fiction" Ready
2024-02-28 12:53:40.981
INFO
[Watcher] "History & Biography" Ready
2024-02-28 12:53:42.313
INFO
[Watcher] "Fiction" Ready
2024-02-28 13:00:00.649
INFO
[LibraryScanner] Library metadata precedence changed since last scan. From [folderStructure,audioMetatags,txtFiles,opfFile,absMetadata] to [audioMetatags,txtFiles,opfFile,absMetadata,folderStructure]
2024-02-28 13:00:00.651
INFO
[LibraryScanner] Starting (forced) library scan 05246d51-dacf-4a88-aafd-9b90c897b4de for Fiction
2024-02-28 13:00:20.746
ERROR
[parseEpubMetadata] Failed to extract META-INF/container.xml from epub at "/audiobooks/Author Name/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion]/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion].epub" Error: ENOENT: no such file or directory, open '/audiobooks/Author Name/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion]/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion].epub'
2024-02-28 13:00:20.749
FATAL
[Server] Unhandled rejection: Error: ENOENT: no such file or directory, open '/audiobooks/Author Name/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion]/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion].epub', promise: Promise { [Error: ENOENT: no such file or directory, open '/audiobooks/Author Name/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion]/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion].epub'] { errno: -2, code: 'ENOENT', syscall: 'open', path: '/audiobooks/Author Name/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion]/Redacted The Step By Step Guide To Redacted by Works, Companion [Works, Companion].epub' } }
Steps to reproduce the issue
I'm not interacting with app or server when this happens. Or I don't think I am? I may have opened the app at those times? Will add to this if that turns out to be the case.
Audiobookshelf version
v2.8.0
How are you running audiobookshelf?
Docker
@sveinbjornpalsson commented on GitHub (Feb 28, 2024):
I've set log level to debug. First thing I did was to run docker-compose, but I don't think it upgraded, I think it was already on latest release (2.8.0)
I just opened the ios client, it seemed to work, it's still up.
@nichwall commented on GitHub (Feb 28, 2024):
So there used to be a file at that location, but then you moved it and now it's crashing the server?
@sveinbjornpalsson commented on GitHub (Feb 28, 2024):
Funny thing is, this crash is recent, but those changes were made quite a while ago.
@nichwall commented on GitHub (Feb 28, 2024):
Does the book exist in your ABS library (shows up without scanning)? If so, does it show up as missing or let you interact with it?
@sveinbjornpalsson commented on GitHub (Mar 1, 2024):
No. I searched for it when I saw the error. No registration of it. Which is
also strange, I haven’t deleted anything. Or I don’t think I have?
On Wed, 28 Feb 2024 at 13:55, Nicholas W @.***> wrote:
@mikiher commented on GitHub (Mar 2, 2024):
There's another thing I don't understand about the logs above
[LibraryScanner] Starting (forced) library scan 05246d51-dacf-4a88-aafd-9b90c897b4de for FictionWho initiated the forced library scan? As far as I understand, the force-rescan option doesn't even exist anymore on the client in recent versions, it's only available through the API. The round hour (13:00:00) on the log entry maybe suggests that the scan was started by the CronManager (although AFAIK the CronManager does not start a forced scan either).
@sveinbjornpalsson commented on GitHub (Mar 2, 2024):
It scans every hour according to settings. I can't remember if I pressed the scan button in Settings > Libraries. Here's the log, hope hit helps?
It's been stable since I started this thread.
crash_logs.txt
@mikiher commented on GitHub (Mar 9, 2024):
Sorry for nagging again, but the unfortunately crash the logs didn't provide me with much additional info.
Can you please also attach the crashed library scan log?
It should be at <your_metadata_dir>/logs/scans/2024-02-28_05246d51-dacf-4a88-aafd-9b90c897b4de.txt
Hopefully it will provide me with some more info regarding what happened right before the crash.
Also, since the crash most probably happens during an automated scan, then as a workaround until we figure the root cause, you can disable the automatic scans for that library. This will most likely stop the recurring crashes.
Also, if the folders for this library are local (i.e. not network mounted), then the watcher is capable of detecting new additions to the library, and there's no need for an automated scan at all. However if the library folders are remote, you indeed need the scan, since watchers will likely not detect changes.
@geminica commented on GitHub (Mar 10, 2024):
I have a similar issue. I moved some epubs to a different directory and now scan crashes. The logs/scan file doesn't show the errors; similar to the OP I get the logged error about failure to extract with "no such file or directory" and then it becomes FATAL immediately after. I haven't finished setting up a dev environment but suspect that on this line, the
containerJsoncan be null and would need to becontainerJson?in order to avoid failure?https://github.com/advplyr/audiobookshelf/blob/0d9d2fa4be9b642f0948e52ddff71ff370fd524d/server/utils/parsers/parseEpubMetadata.js#L73
@mikiher commented on GitHub (Mar 10, 2024):
Thanks for the info.
I will try to reproduce the way you described.
Regarding
containerJson- you're right that it needs to be checked before accessing it, but accessing a null reference doesn't produce an exception like the one we see. However, this means that the code hasn't even reached that point, which means the fatal failure is happening somewhere right before that, but after the ERROR. That narrows it down quite a bit.@mikiher commented on GitHub (Mar 10, 2024):
Ah, great, I was able to reproduce this.
The crash happens during a library scan when all the follwoing conditions are met:
Due to a bug somewhere, although the book path changes, the code tries to open it in its original location, which likely causes the crash (I haven't identified exactly where the crash happens, but at least I understand the root of the problem).
I will work on a fix.
@sveinbjornpalsson commented on GitHub (Mar 11, 2024):
So you don't need the log? I have found it but I'd be happy to skip it :)
@mikiher commented on GitHub (Mar 11, 2024):
No, thank you, I don't need the log anymore
@mikiher commented on GitHub (Mar 11, 2024):
@advplyr, I dug into what happens when you move library files into a different folder in the same library.
It looks like the code that handles these kind of changes seems quite buggy at this point, so I'd like to understand better the considerations behind the organization of the data in LibraryItem records and their associated media (Book/Podcast/PodcastEpisode) records, before I implement a fix.
LibraryItemrecord haslibraryFilescolumnBookrecord hasebookFile,audioFiles, andcoverPathPodcastrecord hascoverPathPodcatEpisoderecord hasaudioFileThe paths in
libraryFilesneed to be in sync with the paths in the various media records, otherwise bad things happen.In this case, inside
LibraryScanner.scanLibrary, when a book directory is moved from one folder to another, the scanner cleverly matches theexistingLibraryItemwith its new location, and then callscheckLibraryItemData, which updatesexistingLibraryItemand saves it in the database too. However, the associated media records are not updated, which corrupts the databsae and causes subsequent crashes.So, my questions, before trying to fix:
@mikiher commented on GitHub (Mar 11, 2024):
Of course, another possibility of fixing this is to remove the clever ino matching code, in which case a folder move would just be identified as a missing book and a new book. I understand you'd rather keep the existing behavior - it's very nice, and takes burden off the user (if it works :)
And in any case, we also need to fix the existing database corruption for users that encountered this bug.
@advplyr commented on GitHub (Mar 12, 2024):
Thanks for digging into that. The issue with the data model you pointed out is something I've wanted to solve for a while now.
Originally when transitioning to sqlite from the JSON db I mapped out a data model that associated audioFiles, ebooks and images with library files but the queries became too complex while we still need to map everything to the old data model. I'm open to ways to bridge that gap though since changing the data model at this point will be a large project.
When I re-wrote the scanner this last time I must have missed updating the other file paths because that used to be handled.
Removing the inode check would cause a lot of issues since users would lose their media progress when renaming a folder.
@mikiher commented on GitHub (Mar 12, 2024):
The approach I was thinking about is the following:
I understand doing this is a serious piece of work, but this is also quite a serious issue.
I'm willing to look into this, if you agree. I can also just fix this specific issue locally, which is proably somewhat easier. Please let me know which you prefer.
Yes, I understand that's not an ideal solution. They would also lose any metadata changes they made.
@advplyr commented on GitHub (Mar 13, 2024):
Right now if you have multiple cover images you can switch between them in the Cover tab. Library files are used for those other covers.
Multiple ebook files are also supported so you can have supplementary material and switch to which is the primary ebook. Library files are used for supplementary ebooks. It would be better if books supported an array of ebooks instead of just one but that is a bigger change we would have to break down.
I like your approach and would prefer that but like you said it is a large project. Excluding media files from the library files array would probably require some refactoring of the mobile apps but I will have to dig into that to see.
@advplyr commented on GitHub (Apr 22, 2024):
Fixed in v2.9.0