Closed paxchristos closed 10 months ago
Roughly how many episodes does your largest podcast have?
~3800 for the largest there are about 4 more in the ~750 -1k episode range
It looks like it's the same error as I see on a few issues so they're probably related:
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
(I'm having the same issue and after updating to 2.4.1, I'm unable to open my podcast library without it crashing, unfortunately I didn't make note of version I was on previously).
I've been following this bug since this issue was created.
EDIT: My largest podcast has ~2175 episodes but it's not the culprit. I started getting this crash after adding a new podcast with ~670 episodes and it crashed after downloading half of them.
Famous last words: I use podgrab to download podcasts, so notionally audiobookshelf shouldn't be downloading podcasts automatically, only serving them.
Right, like I mentioned above, previously, my failure occurred when audiobookshelf was scheduled to download podcasts, but that doesn't mean it was failing at the downloading stage.
Since I'm failing when I open my podcast library as of now, I think it's the same error as before occurring when querying currently downloaded episodes (which it'd have to do to know what to download). That might explain why I'm seeing the error now after a fresh install as well.
@advplyr has noted in a few other places that maybe the sql query being done may need some optimization work for large folder.
I'm seeing the same issue. I'm on v2.3.3 because of the performance issues with 3.4
[2023-10-27 21:02:31] INFO: [PodcastManager] runEpisodeCheck: "Beau of The Fifth Column" | Last check: Thu Aug 03 2023 14:03:35 GMT+0300 (Eastern European Summer Time) | Latest episode pubDate: Thu Aug 03 2023 09:15:00 GMT+0300 (Eastern European Summer Time)
[2023-10-27 21:02:31] DEBUG: [PodcastManager] runEpisodeCheck: "Beau of The Fifth Column" checking for episodes after Thu Aug 03 2023 09:15:00 GMT+0300 (Eastern European Summer Time) (PodcastManager.js:248)
[2023-10-27 21:02:31] DEBUG: [podcastUtils] getPodcastFeed for "https://anchor.fm/s/cff1340/podcast/rss" (podcastUtils.js:206)
[2023-10-27 21:02:57] DEBUG: [podcastUtils] getPodcastFeed for "https://anchor.fm/s/cff1340/podcast/rss" success - parsing xml (podcastUtils.js:222)
[2023-10-27 21:03:01] DEBUG: [PodcastManager] runEpisodeCheck: 30 episodes found (PodcastManager.js:251)
[2023-10-27 21:03:01] INFO: [PodcastManager] Found 30 new episodes for podcast "Beau of The Fifth Column" - starting download
[2023-10-27 21:03:01] DEBUG: [Watcher] Ignoring directory "/podcasts/Beau of The Fifth Column" (Watcher.js:207)
[2023-10-27 21:03:03] DEBUG: [FfmpegHelpers] downloadPodcastEpisode: Cmd: ffmpeg -i pipe:0 -y -c copy -metadata podcast=1 -metadata album=Beau of The Fifth Column -metadata album-sort=Beau of The Fifth Column -metadata artist=Beau of The Fifth Column -metadata artist-sort=Beau of The Fifth Column -metadata comment=<p>Let's talk about water, ice, and Antarctica....</p>
---
Send in a voice message: https://podcasters.spotify.com/pod/show/beau-of-the-fifth-column/message
Support this podcast: <a href="https://podcasters.spotify.com/pod/show/beau-of-the-fifth-column/support">https://podcasters.spotify.com/pod/show/beau-of-the-fifth-column/support</a> -metadata genre=Society & Culture;Podcasts -metadata MVNM=Beau of The Fifth Column -metadata title=Let's talk about water, ice, and Antarctica.... -metadata title-sort=Let's talk about water, ice, and Antarctica.... -metadata year=2023 -metadata date=Fri, 27 Oct 2023 03:46:00 GMT -metadata releasedate=Fri, 27 Oct 2023 03:46:00 GMT -metadata itunes-id=1479080781 -metadata podcast-type=episodic /podcasts/Beau of The Fifth Column/Let's talk about water, ice, and Antarctica.... (c526e717-4c1f-4008-8d66-ef7a3ae89f3b).mp3 (ffmpegHelpers.js:151)
[2023-10-27 21:03:04] DEBUG: [FfmpegHelpers] downloadPodcastEpisode: Complete (ffmpegHelpers.js:158)
<--- Last few GCs --->
[1:0x7fb44c0e8410] 3608899 ms: Mark-sweep (reduce) 4081.8 (4114.8) -> 4081.8 (4114.8) MB, 72.9 / 0.0 ms (+ 277.4 ms in 5 steps since start of marking, biggest step 77.2 ms, walltime since start of marking 398 ms) (average mu = 0.769, current mu = 0.340)[1:0x7fb44c0e8410] 3609180 ms: Mark-sweep (reduce) 4083.1 (4116.2) -> 4083.1 (4116.2) MB, 279.3 / 0.0 ms (average mu = 0.611, current mu = 0.007) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Config /config /metadata
[2023-10-27 21:03:18] INFO: === Starting Server ===
[2023-10-27 21:03:18] INFO: [Server] Init v2.3.3
In my case it's happening when downloading new episodes for a very large podcast.
Just an update, crashing still happening with the same errors on 2.5.0 (docker)
@paxchristos
Try adding NODE_OPTIONS=--max_old_space_size=8192
back in your Environment Variables in your Docker Compose as mentioned in #1926.
This was removed a few releases ago since the OOM Crash was mostly resolved outside of edge cases like this.
@paxchristos
Try adding
NODE_OPTIONS=--max_old_space_size=8192
back in your Environment Variables in your Docker Compose as mentioned in #1926.
I forgot that I left NODE_OPTIONS=--max_old_space_size=1024
in .env from testing before. Changing it from 1gb to 8gb allows library to load w/o crashing, but once I click into a ~3800 track podcast, it crashes w/ FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
...but once I click into a ~3800 track podcast, it crashes...
Is this when trying to download a 3800 track podcast list or opening an existing library?
I'm thinking it has something to do with loading all the track details into memory. Maybe we need to look into figuring out how to split this into batches since increasing space size for larger and larger libraries is a losing game.
I managed to be able to load the library of my podcast (1500 episodes) by increasing --max_old_space_size,
but starting playback causes the socket to disconnect. Server is in debug mode, but basically nothing appears in the log. Network log on front end says NS_BINDING_ABORTED
and finally 502
error.
Is this related at all? I am resuming playback from the homepage. Any other podcasts start just fine.
@aunefyren That's unrelated since it's coming from cloudflare.
Actually if the server is crashing then it is Abs, but not sure why cloudflare would return a 502. Note that the logs from Abs won't show errors that aren't caught. You would have to see those by looking at the container logs
Actually if the server is crashing then it is Abs, but not sure why cloudflare would return a 502. Note that the logs from Abs won't show errors that aren't caught. You would have to see those by looking at the container logs
I think when the Cloudflare proxy fails to connect to ABS (because it crashes) it gives a 502 error. If I disable Cloudflare proxy I just get NS_BINDING_ABORTED
in the browser.
Sorry if I was unclear about logs. The server is in debug mode and the container logs is very empty for errors:
[2023-10-31 19:20:49] DEBUG: Loaded 3 personalized shelves in 0.21s (LibraryItem.js:667)
[2023-10-31 19:20:50] DEBUG: [SocketAuthority] User Offline aune (SocketAuthority.js:116)
[2023-10-31 19:20:50] INFO: [SocketAuthority] Socket AogDLsaKKA-0bBa0AAAb disconnected from client "aune" after 157343ms (Reason: transport close)
[2023-10-31 19:22:12] DEBUG: [PlaybackSessionManager] startSessionRequest for device Windows 10 / Chrome (PlaybackSessionManager.js:64)
[2023-10-31 19:22:12] DEBUG: [PlaybackSessionManager] "aune" starting direct play session for item "1bb7348e-41ff-490f-b33a-7c1ad1d6e432" with id ad6ce930-041c-4153-ba7b-dd17a42d9296 (Device: Windows 10 / Chrome) (PlaybackSessionManager.js:240)
[2023-10-31 19:23:13] DEBUG: [PlaybackSessionManager] syncSession "ad6ce930-041c-4153-ba7b-dd17a42d9296" (Device: Windows 10 / Chrome) | Total Time Listened: 20 (PlaybackSessionManager.js:276)
[2023-10-31 19:23:31] DEBUG: [PlaybackSessionManager] syncSession "ad6ce930-041c-4153-ba7b-dd17a42d9296" (Device: Windows 10 / Chrome) | Total Time Listened: 30 (PlaybackSessionManager.js:276)
In this timeframe I loaded the home page, resumed playback on a podcast with 1500 tracks, and had it stop syncing progress. Same behavior on Android app, except playback never starts.
I can open another issue or redirect my comment if this is unrelated.
Updates were made in v2.7.1 for large podcast libraries. I'm not sure if the OOM issues will be resolved since I didn't change the data model but let me know if you get a chance to test v2.7.1
My playback issues are resolved.
Updates were made in v2.7.1 for large podcast libraries. I'm not sure if the OOM issues will be resolved since I didn't change the data model but let me know if you get a chance to test v2.7.1
Just updated and tested it out on both Web and iOS app and have no OOM issues now. Podcasts load much faster now as well.
Tested this on 2 sets of 1k+ episode podcasts.
Thanks @advplyr
@advplyr
A few day's have gone by and I've noticed I've gotten the OOM crash again, it looks like it's failing to clear the cache during parsing for new episodes to download.
...
2024/01/03 12:01:01,stdout,[0m
2024/01/03 12:01:00,stdout,[0m[37;40mnpm[0m [0m[31;40mERR![0m[35m[0m /root/.npm/_logs/2024-01-03T16_16_31_334Z-debug-0.log
2024/01/03 12:01:00,stdout,[37;40mnpm[0m [0m[31;40mERR![0m[35m[0m A complete log of this run can be found in:
2024/01/03 12:01:00,stdout,[0m
2024/01/03 12:01:00,stdout,[0m[37;40mnpm[0m [0m[31;40mERR![0m [0m[35mcommand[0m sh -c -- node index.js
2024/01/03 12:01:00,stdout,[0m[37;40mnpm[0m [0m[31;40mERR![0m [0m[35msignal[0m SIGABRT
2024/01/03 12:01:00,stdout,[0m[37;40mnpm[0m [0m[31;40mERR![0m[35m[0m command failed
2024/01/03 12:01:00,stdout,[37;40mnpm[0m [0m[31;40mERR![0m [0m[35mpath[0m /
2024/01/03 12:00:40,stdout,FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
2024/01/03 12:00:40,stdout,
2024/01/03 12:00:40,stdout,<--- JS stacktrace --->
2024/01/03 12:00:40,stdout,
2024/01/03 12:00:40,stdout,
2024/01/03 12:00:40,stdout,"[17:0x7fce68b773f0] 2649106 ms: Mark-sweep (reduce) 2044.4 (2060.9) -> 2044.4 (2060.4) MB, 24.3 / 0.0 ms (+ 41.5 ms in 3 steps since start of marking, biggest step 41.5 ms, walltime since start of marking 83 ms) (average mu = 0.988, current mu = 0.476) [17:0x7fce68b773f0] 2649236 ms: Mark-sweep (reduce) 2045.7 (2061.6) -> 2045.6 (2061.9) MB, 127.1 / 0.0 ms (average mu = 0.962, current mu = 0.029) allocation failure scavenge might not succeed
"
2024/01/03 12:00:40,stdout,
2024/01/03 12:00:40,stdout,<--- Last few GCs --->
2024/01/03 12:00:40,stdout,
2024/01/03 12:00:32,stdout,[2024-01-03 17:00:32.516] DEBUG: [LibraryItem] Success saving abmetadata to "/metadata/items/c9ea4781-75ec-47fb-8923-d27f386f6081/metadata.json" (LibraryItem.js:310)
2024/01/03 12:00:32,stdout,[2024-01-03 17:00:32.510] DEBUG: [PodcastManager] No new episodes for "Stuff You Should Know" (PodcastManager.js:266)
2024/01/03 12:00:32,stdout,[2024-01-03 17:00:32.510] DEBUG: [PodcastManager] runEpisodeCheck: N/A episodes found (PodcastManager.js:247)
2024/01/03 12:00:29,stdout,[2024-01-03 17:00:29.918] DEBUG: [podcastUtils] getPodcastFeed for "https://www.omnycontent.com/d/playlist/e73c998e-6e60-432f-8610-ae210140c5b1/a91018a4-ea4f-4130-bf55-ae270180c327/44710ecc-10bb-48d1-93c7-ae270180c33e/podcast.rss" success - parsing xml (podcastUtils.js:254)
2024/01/03 12:00:29,stdout,[2024-01-03 17:00:29.397] DEBUG: [podcastUtils] getPodcastFeed for "https://www.omnycontent.com/d/playlist/e73c998e-6e60-432f-8610-ae210140c5b1/a91018a4-ea4f-4130-bf55-ae270180c327/44710ecc-10bb-48d1-93c7-ae270180c33e/podcast.rss" (podcastUtils.js:229)
2024/01/03 12:00:29,stdout,[2024-01-03 17:00:29.397] DEBUG: [PodcastManager] runEpisodeCheck: "Stuff You Should Know" checking for episodes after Wed Jan 03 2024 10:00:00 GMT+0000 (Coordinated Universal Time) (PodcastManager.js:244)
2024/01/03 12:00:29,stdout,[2024-01-03 17:00:29.397] INFO: [PodcastManager] runEpisodeCheck: "Stuff You Should Know" | Last check: Wed Jan 03 2024 14:01:32 GMT+0000 (Coordinated Universal Time) | Latest episode pubDate: Wed Jan 03 2024 10:00:00 GMT+0000 (Coordinated Universal Time)
2024/01/03 12:00:29,stdout,[2024-01-03 17:00:29.345] DEBUG: [ApiCacheManager] podcast.afterUpdate: Clearing cache (ApiCacheManager.js:21)
...
I'm on 2.7.2 and getting the same JavaScript heap out of memory
error. I have been loading a lot of things: audiobooks and a lot of files from my podcast collection. Log of the docker file attached. Any idea how to prevent it, please? I have lots more RAM to spare on that machine, so would be happy with a setting to bump up the allocated RAM.
_arr-audiobookshelf-1_logs.txt
I will try the environment variables from https://github.com/advplyr/audiobookshelf/issues/1926#issuecomment-1639020501 to tell node.js to augment its memory allocation, see if it helps.
Describe the issue
Upgraded to 2.4.1 from 2.3.3, was able to scan podcast library (haven't been able to do so since 2.3.x, thank you for the fix!)
Selected Podcast library, then went to library and the server starts crashing. If you leave open the webpage for the library, it'll enter a loop of starting the same process and crashing the server until the page is closed.
Podcast Library stats: 21 library items 10799 tracks
Machine Stats: ubuntu 22.04.03 i3 10100 16gb ram 256gb m2 nvme
Here's the exact OOM crash:
Here's a larger section of the log:
Steps to reproduce the issue
Audiobookshelf version
2.4.1
How are you running audiobookshelf?
Debian/PPA