Skip to content

fix: prevent memory/CPU leaks in importer and nzbfilesystem - #143

Merged
javi11 merged 1 commit into
mainfrom
fix/memory-cpu-leak-prevention
Dec 17, 2025
Merged

fix: prevent memory/CPU leaks in importer and nzbfilesystem#143
javi11 merged 1 commit into
mainfrom
fix/memory-cpu-leak-prevention

Conversation

@javi11

@javi11 javi11 commented Dec 17, 2025

Copy link
Copy Markdown
Collaborator

Summary

  • Replace fire-and-forget goroutines in updateFileHealthOnError with synchronous operations using a 5-second timeout context to prevent unbounded goroutine accumulation when reading corrupted files
  • Wrap segment reader operations in parser.go with closure and defer to ensure cleanup happens regardless of how the loop exits
  • Add channel draining in NzbDav import defer block to prevent parser goroutine from blocking indefinitely when import is cancelled

Test plan

  • Verify corrupted file health updates still work correctly
  • Test NzbDav import with cancellation
  • Monitor goroutine count under load using pprof or runtime.NumGoroutine()

🤖 Generated with Claude Code

- Replace fire-and-forget goroutines in updateFileHealthOnError with
  synchronous operations using a 5-second timeout context to prevent
  unbounded goroutine accumulation when reading corrupted files

- Wrap segment reader operations in parser.go with closure and defer
  to ensure cleanup happens regardless of how the loop exits

- Add channel draining in NzbDav import defer block to prevent parser
  goroutine from blocking indefinitely when import is cancelled

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@javi11
javi11 merged commit 34a9a50 into main Dec 17, 2025
1 check passed
@javi11
javi11 deleted the fix/memory-cpu-leak-prevention branch February 4, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant