[PR #1484] [MERGED] Reduce memory usage when scanning large folders #3557

Closed
opened 2026-04-25 00:16:07 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/1484
Author: @magnww
Created: 2/6/2023
Status: Merged
Merged: 2/7/2023
Merged by: @advplyr

Base: masterHead: fix_oom_crash


📝 Commits (3)

  • 19e39f6 kill zombie processes to reduce memory usage
  • 61c32d9 scan media files in batches
  • ba07761 Revert "kill zombie processes to reduce memory usage"

📊 Changes

1 file changed (+9 additions, -4 deletions)

View changed files

📝 server/scanner/MediaFileScanner.js (+9 -4)

📄 Description

When audiobookshelf scans a folder with a lot of files, it will take up a lot of memory, because audiobookshelf will start a ffprobe process for each media file at the same time. In order to reduce memory usage, it is necessary to limit the number of ffprobe processes started at the same time.
In addition, after the ffprobe process is executed, it does not exit immediately and becomes a zombie process. It is necessary to call kill() in the exit event to end the process.

Before:
图片

After:
图片


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/1484 **Author:** [@magnww](https://github.com/magnww) **Created:** 2/6/2023 **Status:** ✅ Merged **Merged:** 2/7/2023 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `fix_oom_crash` --- ### 📝 Commits (3) - [`19e39f6`](https://github.com/advplyr/audiobookshelf/commit/19e39f63210d5243ec91369d1e0da80f7dd5a934) kill zombie processes to reduce memory usage - [`61c32d9`](https://github.com/advplyr/audiobookshelf/commit/61c32d99e7f13f7a0d30d5789289a5155d3cdb80) scan media files in batches - [`ba07761`](https://github.com/advplyr/audiobookshelf/commit/ba07761de3093445f6dd0d9a247e1c85b2e5451f) Revert "kill zombie processes to reduce memory usage" ### 📊 Changes **1 file changed** (+9 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `server/scanner/MediaFileScanner.js` (+9 -4) </details> ### 📄 Description When audiobookshelf scans a folder with a lot of files, it will take up a lot of memory, because audiobookshelf will start a ffprobe process for each media file at the same time. In order to reduce memory usage, it is necessary to limit the number of ffprobe processes started at the same time. In addition, after the ffprobe process is executed, it does not exit immediately and becomes a zombie process. It is necessary to call kill() in the exit event to end the process. Before: ![图片](https://user-images.githubusercontent.com/7497333/217028162-6b6dbb8f-192a-40e0-8203-1b10246b5787.png) After: ![图片](https://user-images.githubusercontent.com/7497333/217028203-d6ef70d8-a9ec-4e2c-8f2c-f159025d96d3.png) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:16:07 +02:00
adam closed this issue 2026-04-25 00:16:07 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3557