Skip to content

Fix: Remove redundant enabled checks in HLS/DASH cleanup to prevent resource leaks. v6.0.173 v7.0.54#4161

Merged
winlinvip merged 5 commits intoossrs:developfrom
suzp1984:fix/hls_cleanup
Aug 14, 2025
Merged

Fix: Remove redundant enabled checks in HLS/DASH cleanup to prevent resource leaks. v6.0.173 v7.0.54#4161
winlinvip merged 5 commits intoossrs:developfrom
suzp1984:fix/hls_cleanup

Conversation

@suzp1984
Copy link
Copy Markdown
Contributor

@suzp1984 suzp1984 commented Aug 29, 2024

Problem

HLS and DASH components had redundant enabled flag checks in their cycle() and cleanup_delay() methods that prevented proper cleanup of files when components were disabled. This created a race condition where:

  1. Stream stops publishing and HLS/DASH components get disabled
  2. cycle() returns early without performing disposal operations
  3. cleanup_delay() returns 0 instead of configured disposal timeout
  4. Source cleanup doesn't wait long enough for file disposal
  5. HLS/DASH files remain on disk without proper cleanup

Root Cause

The enabled flag should control processing of new incoming streams, but should NOT prevent cleanup of existing files from previously enabled streams.

Solution

Remove redundant enabled checks from:

  • SrsHls::cycle() and SrsDash::cycle() - Allow disposal logic to run even when disabled
  • SrsHls::cleanup_delay() and SrsDash::cleanup_delay() - Always return proper disposal timeout

@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Aug 29, 2024
@winlinvip

This comment was marked as resolved.

@cdgraff
Copy link
Copy Markdown

cdgraff commented Nov 19, 2024

+1 I reach here for the same issue, some timeline to fix this? or merge this changes?

@pisken
Copy link
Copy Markdown

pisken commented Nov 22, 2024

hi, how long to release this fix? I'm having this problem and it's causing disk space overflow.

@winlinvip winlinvip changed the title fix hls & dash segments cleanup. fix hls & dash segments cleanup. v6.0.173 v7.0.54 Aug 14, 2025
@winlinvip winlinvip added the RefinedByAI Refined by AI/GPT. label Aug 14, 2025
@winlinvip winlinvip changed the title fix hls & dash segments cleanup. v6.0.173 v7.0.54 Fix: Remove redundant enabled checks in HLS/DASH cleanup to prevent resource leaks. v6.0.173 v7.0.54 Aug 14, 2025
@winlinvip winlinvip merged commit 9b871fd into ossrs:develop Aug 14, 2025
17 checks passed
winlinvip added a commit that referenced this pull request Aug 14, 2025
…esource leaks. v6.0.173 (#4161)

HLS and DASH components had redundant `enabled` flag checks in their
`cycle()` and `cleanup_delay()` methods that prevented proper cleanup of
files when components were disabled. This created a race condition
where:

1. Stream stops publishing and HLS/DASH components get disabled
2. `cycle()` returns early without performing disposal operations
3. `cleanup_delay()` returns 0 instead of configured disposal timeout
4. Source cleanup doesn't wait long enough for file disposal
5. HLS/DASH files remain on disk without proper cleanup

The `enabled` flag should control processing of **new incoming
streams**, but should NOT prevent **cleanup of existing files** from
previously enabled streams.

Remove redundant `enabled` checks from:
- `SrsHls::cycle()` and `SrsDash::cycle()` - Allow disposal logic to run
even when disabled
- `SrsHls::cleanup_delay()` and `SrsDash::cleanup_delay()` - Always
return proper disposal timeout

---------

Co-authored-by: winlin <winlinvip@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EnglishNative This issue is conveyed exclusively in English. RefinedByAI Refined by AI/GPT.

Development

Successfully merging this pull request may close these issues.

4 participants