mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
[PR #3761] Fix DI memory leak #9681
Reference in New Issue
Block a user
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?
Original Pull Request: https://github.com/jellyfin/jellyfin/pull/3761
State: closed
Merged: Yes
Changes
Removed
JellyfinDbfrom the DI container for now. Registering Transient instances that implement IDisposable and then using them in the root scope is a big no-no. They will never be GC'd until the container or scope is disposed, which will only happen on shutdown.An alternative solution is to create a Scope whenever we need the context, but the factory pattern is cleaner.
DISCLAIMER: I haven't actually been able to reproduce the leak, but based on memory snapshots and research it seems like the most likely scenario.
Sources:
Issues
Fixes #3680