mirror of
https://github.com/tubearchivist/tubearchivist-jf-plugin.git
synced 2026-03-23 20:37:14 +00:00
[PR #64] [CLOSED] Fix/http client disposal #79
Labels
No labels
bug
enhancement
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tubearchivist/archived-tubearchivist-jf-plugin#79
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/tubearchivist/tubearchivist-jf-plugin/pull/64
Author: @mattkduran
Created: 10/18/2025
Status: ❌ Closed
Base:
master← Head:fix/http-client-disposal📝 Commits (6)
ab561abFix: Implement IDisposable to properly clean up resourcesf8231f1Fix: Implement IDisposable to properly clean up resources0533abbUpdate initializationd9aaa8dFixed loopeb59a87Fix resource leaks, crashes, and add comprehensive error handling9b2ad42Added doc strings to clarify complex logic for caching methods📊 Changes
9 files changed (+1321 additions, -57 deletions)
View changed files
➕
.github/workflows/test.yaml(+19 -0)➕
Jellyfin.Plugin.TubeArchivistMetadata.Tests/CollectionMembershipTests.cs(+360 -0)➕
Jellyfin.Plugin.TubeArchivistMetadata.Tests/CollectionTests.cs(+307 -0)➕
Jellyfin.Plugin.TubeArchivistMetadata.Tests/GlobalUsings.cs(+1 -0)➕
Jellyfin.Plugin.TubeArchivistMetadata.Tests/Jellyfin.Plugin.TubeArchivistMetadata.Tests.csproj(+30 -0)➕
Jellyfin.Plugin.TubeArchivistMetadata.Tests/PluginTests.cs(+178 -0)➕
Jellyfin.Plugin.TubeArchivistMetadata.Tests/UnitTest1.cs(+10 -0)📝
Jellyfin.Plugin.TubeArchivistMetadata/Configuration/PluginConfiguration.cs(+41 -8)📝
Jellyfin.Plugin.TubeArchivistMetadata/Plugin.cs(+375 -49)📄 Description
Fix: Resource leaks and crashes when playing non-TubeArchivist media
This PR addresses multiple critical bugs that cause Jellyfin to crash and leak system resources.
Issues Fixed
System.ArgumentException: Guid can't be empty)Root Cause Analysis
Crash Issues (#29, #60):
The plugin was attempting to traverse parent hierarchy for ALL media during playback, including Live TV and movies which have invalid/empty parent GUIDs. This caused
LibraryManager.GetItemById(Guid id)to throw exceptions and crash Jellyfin.Resource Leak:
The
HttpClientandHttpClientHandlercreated in the Plugin constructor were never disposed, leading to:Changes Made
1. Implement IDisposable Pattern
IDisposableHttpClientandHttpClientHandleron shutdownPlaybackProgressandUserDataSavedevents2. Efficient Collection Validation with Caching
IsItemInTubeArchivistCollection()method with:RefreshTubeArchivistCollectionId()for configuration changes3. Improved Event Handlers
OnPlaybackProgressandOnWatchedStatusChangenow validate items BEFORE attempting hierarchy traversal4. Comprehensive Test Suite
Added 23 tests covering:
Plugin lifecycle tests (8 tests)
Collection caching tests (7 tests)
Collection membership validation tests (8 tests)
Technical Details
Before:
After:
Performance Improvements
Breaking Changes
None - fully backward compatible.
Testing
All 23 tests pass:
Test infrastructure established for future contributions.
Related PRs
This PR supersedes and extends:
Those PRs can be closed as this includes their fixes with additional improvements and comprehensive test coverage.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.