mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Bug]: JavaScript heap out of memory #2211
Closed
opened 2026-04-25 00:04:59 +02:00 by adam
·
26 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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.3.4
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#2211
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 @mpclepto on GitHub (Aug 25, 2024).
What happened?
ABS is crashing roughly 2-5 times per day with stated error
What did you expect to happen?
No crash, stable uptime
Steps to reproduce the issue
Audiobookshelf version
v2.12.3
How are you running audiobookshelf?
Other (list in "Additional Notes" box)
What OS is your Audiobookshelf server hosted from?
Other (list in "Additional Notes" box)
If the issue is being seen in the UI, what browsers are you seeing the problem on?
None
Logs
Additional Notes
unRaid 6.12.6
ABS from unRaid approved apps list
@viskanic commented on GitHub (Aug 28, 2024):
I'm getting the same crash 😞
Docker image version:
2.12.3Unraid version:
6.12.13I've checked the location
/metadata/logs/crash_logs.txt, but no file was generated.@advplyr commented on GitHub (Aug 28, 2024):
How big is your library?
@mpclepto commented on GitHub (Aug 29, 2024):
Items - 283
Authors - 179
Size (gb) - 93.1
Audio Tracks - 3542
Also ditto on what viskanic said, no useful information in /metadata/logs/crash_logs.txt all though the file does exist.
@viskanic commented on GitHub (Aug 29, 2024):
I have two libraries:
Podcasts:
Items in Library: 21
Size (GB): 514.9
Audio Tracks: 5,031
Books:
Items in Library: 18
Size (GB): 8.3
Audio Tracks: 2,942
I've added the
--restart unless-stoppedto my docker configuration, so it will restart the container if it crashed.I've also switched to the
debuglog level under settings.What I've noticed today is that I'm getting a
=== Starting Server ===message at the beginning of each hour.Update:
The crash seem to be connected with the cron jobs that are enabled on each podcast to check for updated each hour. I still can't confirm it, but I've updated each podcast to run the cron job only once per day. They are all scheduled to run at the same time, so we'll see what happens.
I'll write back as soon as I know more.
@mpclepto commented on GitHub (Aug 31, 2024):
I have been digging into this more today as well and I believe mine is also tied to cron downloads, however, I don't think it is the cron specifically. I have a certain podcast that is set to check / download daily. This podcast hasn't downloaded the latest 6 episodes and so I am doing so manually, however, ABS crashes constantly while trying to download. I'm doing a single episode at a time and it can't do it, crashes before finishing each time.
@advplyr commented on GitHub (Aug 31, 2024):
Your library isn't big so I'm not sure how you could be hitting memory limits. Maybe it is tied to a specific podcast RSS feed? Some podcast RSS feeds are large and there is no way to only request parts of it.
@mpclepto commented on GitHub (Aug 31, 2024):
Unsure if unrelated, but I'm seeing a multitude of partial downloads even though there is a successful download. This is for all podcast subscriptions. This may be due to crashing while the cron's are download until finally it doesn't. For instance, pic related shows the full episode downloaded at the bottom with all the failed attempts above

.
@advplyr commented on GitHub (Aug 31, 2024):
How many podcast crons do you have running at the same time? Can you stagger them so that only one runs at a time.
@mpclepto commented on GitHub (Aug 31, 2024):
Not many, at most there are 4 podcasts scanning at the same time. But I just staggered everything so at worst only 2 podcasts would search at once. I only have 5 podcasts monitored in total, so not many.
@viskanic commented on GitHub (Sep 1, 2024):
Hi everyone 👋
Here is a quick update from what I've been able to observe.
I have 21 podcasts in my library, they are all scheduled to check for updates at the same time once per day, but only one is causing the crash.
The Joe Rogan Experiencehas almost 2200 episodes and it breaks ABS somewhere in the region between 2k - 2.2k episodes.I've removed some of the episodes that I wasn't interested in and everything went back to normal. Now I have 2008 episodes in my library, but I'm guessing it's only a matter of time before this starts happening again.
@advplyr Could you try to pull the data from the same podcast to see if you can reproduce the crash.
Your help is much appreciated 💪
Cheers 😃
@advplyr commented on GitHub (Sep 1, 2024):
One of the issues is that when Abs fetches a podcast from the database it is fetching the podcast and every episode. A podcast episode from the database includes the Audio File object which includes all of the data we use from that file including meta tags and chapter markers.
The data model needs to be changed so that the
PodcastEpisodetable does not store all of the Audio File data. The API needs to be changed to not send every podcast episode when fetching a podcast. Podcast episode requests should be paginated.There are other areas where we also store/load too much data. The
LibraryItemtable stores the file metadata (inode, mtime, ctime, etc) for every file that is a part of that library item in thelibraryFilescolumn. That includes cover images, metadata files, audio files, etc.The groundwork required to solve these problems has already been getting done over the last year. It will take a good amount of time before the large podcast issue gets resolved but I think we're moving in the right direction.
In the meantime what I recommend if you have a large library that is running out of memory is to increase the amount of memory until we can improve our data model & API.
The max memory limit is typically 4GB but may vary depending on the system.
You can set this to 6GB by passing an environment variable (documented here):
I would consider that a temporary change since we should be able to significantly reduce the memory usage in the future.
@viskanic commented on GitHub (Sep 1, 2024):
@advplyr Thank you for your detailed and prompt reply.
I will update the environment variable to prevent the crash 👍
@mpclepto commented on GitHub (Sep 1, 2024):
Interesting, I'm glad the other poster mentioned Joe Rogan as I have this as well and noticed the most issues here. However, I do have even larger podcasts that did not have problems. Regardless, I will also update this variable as well and monitor. Thanks!
@Deekerman commented on GitHub (Sep 2, 2024):
can we make it any size? 8 or 12 gb?
@viskanic commented on GitHub (Sep 2, 2024):
@Deekerman I've set it to
--max-old-space-size=8192and it worked as expected 👍You can set it as high as you want as long as you have free RAM on your machine.
@Deekerman commented on GitHub (Sep 2, 2024):
@viskanic
can you tell me where i find the damn file lol
mine is in pve so i can just add more ram as needed.
@viskanic commented on GitHub (Sep 2, 2024):
@Deekerman There is no file.
You need to update your Docker config to include the environment variable.
Key
NODE_OPTIONSValue
--max-old-space-size=8192.In Unraid it looks like this:

@Deekerman commented on GitHub (Sep 2, 2024):
oh i did it this way
but i found the file with this link lol
https://www.audiobookshelf.org/docs#linux-install-deb
@viskanic
but that still doesnt help lol
this right?
@viskanic commented on GitHub (Sep 2, 2024):
@Deekerman
You didn't specify the key:value pair correctly.
Update the config with the following line:
NODE_OPTIONS=--max-old-space-size=8192@Deekerman commented on GitHub (Sep 2, 2024):
i just realized that. didnt seem to fix anything. jre still drops off
@mpclepto commented on GitHub (Sep 2, 2024):
Just checking in to confirm that I have had no crashes the last day and that was from bumping the space to 6gb. Now, I did set my crons to be staggered the day prior, so 6gb may be enough. However, I have bumped it to 8gb in hopes that I never see the issue again.
I did so via unraid docker options like in @viskanic screenshot.
@mpclepto commented on GitHub (Sep 6, 2024):
Just updating this thread to report 3 more days of issue free running. This appears to have entirely solved my problem. From 3-5 crashes a day without fail to zero the last several. Thanks for the help all!
@mikiher commented on GitHub (Nov 18, 2024):
Release v2.17.0 should have fixed a couple of OOM issue related to manual and automatic Podcast episode checks and downloads. I'd be very interested to know if you're still seeing issues (don't forget to remove the
--max-old-space-size=8192option before checking)@Deekerman commented on GitHub (Nov 18, 2024):
@mikiher this seems to have fixed most of the issues i had run into with podcasts. I will monitor over the next day or so, but i managed to dl all of a show i couldnt before.
Thanks!!!!
@TaylorMichaelHall commented on GitHub (Nov 19, 2024):
I was having this issue as well with a podcast of 1500+ episodes downloaded. It is able to pull that podcast now without the
max-old-space-sizeflag since updating to 2.17.1@advplyr commented on GitHub (Nov 19, 2024):
Thanks everyone for testing!