[PR #15695] [CLOSED] Fix stack overflow during scan #14212

Closed
opened 2025-12-22 10:22:55 +01:00 by backuprepo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/15695
Author: @myzhysz
Created: 12/2/2025
Status: Closed

Base: masterHead: fix-15000


📝 Commits (1)

📊 Changes

1 file changed (+6 additions, -27 deletions)

View changed files

📝 MediaBrowser.Controller/LibraryTaskScheduler/LimitedConcurrencyLibraryScheduler.cs (+6 -27)

📄 Description

In function Enqueue, if we enter the "we are in a nested loop" block, the logic try get a item from _tasks, making function Enqueue not process the file in subfolder, but start from a new folder which increase Call Stack. This make the length of Call Stack is not depends on the depth of filesystem, but the count of subfolders. Therefore, if there are lots of subfolders, the Call Stack will exceed a certain limit and cause Stack Overflow.

Changes
When _deadlockDetector.Value is not null, using existed ForceSequentialOperation.

Issues
Fixes #15000


🔄 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/jellyfin/jellyfin/pull/15695 **Author:** [@myzhysz](https://github.com/myzhysz) **Created:** 12/2/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix-15000` --- ### 📝 Commits (1) - [`207783f`](https://github.com/jellyfin/jellyfin/commit/207783fed59272929769f2f65a97128ffadfa1b8) Fix Stack Overflow #15000 ### 📊 Changes **1 file changed** (+6 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `MediaBrowser.Controller/LibraryTaskScheduler/LimitedConcurrencyLibraryScheduler.cs` (+6 -27) </details> ### 📄 Description In function Enqueue, if we enter the "we are in a nested loop" block, the logic try get a item from _tasks, making function Enqueue not process the file in subfolder, but start from a new folder which increase Call Stack. This make the length of Call Stack is not depends on the depth of filesystem, but the count of subfolders. Therefore, if there are lots of subfolders, the Call Stack will exceed a certain limit and cause Stack Overflow. **Changes** When _deadlockDetector.Value is not null, using existed ForceSequentialOperation. **Issues** Fixes #15000 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
backuprepo 2025-12-22 10:22:56 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: starred/jellyfin#14212
No description provided.