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

Closed
opened 2026-02-07 07:29:06 +03:00 by OVERLORD · 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>
OVERLORD added the pull-request label 2026-02-07 07:29:06 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#14391