Develop - #686
Merged
Merged
Conversation
Fix browser/GPU crash caused by leaked video players when closing the video modal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to file and resource cleanup, security, and code maintainability across the backend and frontend. The main changes include refactoring and centralizing the logic for deleting video files and canceling pending transcode jobs, improving upload folder sanitization, and enhancing media resource management in the frontend to prevent resource leaks.
Backend: Video Deletion and Cleanup Improvements
delete_video_fileshelper, which robustly removes all on-disk artifacts and logs errors per file, replacing duplicated code in multiple endpoints (video.py,game.py,tag.py,admin.py). [1] [2] [3] [4] [5]cancel_pending_transcode_jobshelper to ensure any queued transcode jobs for deleted videos are removed, preventing orphaned jobs from recreating deleted files. This is now called in all relevant delete endpoints. [1] [2] [3] [4] [5]remove_derived_dir, handling race conditions with background jobs.Backend: Upload Folder Security and Consistency
sanitize_upload_folderhelper, ensuring user-supplied upload folder names are safe and consistent across all upload endpoints (upload.py,image.py). [1] [2] [3] [4] [5] [6] [7]Frontend: Media Resource Management
VideoModal.js, explicitly nullifies the player reference on modal close to allow garbage collection of the<video>element and its decoder resources.VideoJSPlayer.js, ensures the<video>element is fully detached from its media source on unmount, preventing Chrome from leaking decoder resources and avoiding GPU process crashes.Other Improvements
These changes make file operations more reliable, improve upload security, and address potential frontend resource leaks.