mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
[PR #13411] [MERGED] Use WriteThrough for ImageSaver #13571
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?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/13411
Author: @gnattu
Created: 1/24/2025
Status: ✅ Merged
Merged: 1/25/2025
Merged by: @joshuaboniface
Base:
release-10.10.z← Head:use-writethrough-imagesaver📝 Commits (1)
644df35Use WriteThrough for ImageSaver📊 Changes
1 file changed (+1 additions, -0 deletions)
View changed files
📝
MediaBrowser.Providers/Manager/ImageSaver.cs(+1 -0)📄 Description
When writing an image to the disk, we use the completion of the async task as a signal indicating the completion of a write operation. However, this approach may not be entirely accurate, as the operating system can optimize IO operations by writing data to an intermediate cache instead of directly to the disk before completing the operation. This optimization can lead to a data race for our scanner, as subsequent tasks such as blurhash computation may attempt to read a file that has not yet been flushed from the volatile cache. Consequently, the data within the file becomes invalid, causing the blurhash computation task to fail.
Use WriteThrough mode to ensure the data is actual on disk before return to resolve this issue.
Changes
Issues
Fixes #3687
If https://github.com/Bond-009/BlurHashSharp/pull/87 is merged and BlurHashSharp get updated, as there is another race condition when multiple threads attempting to open the same image file, but the native open method in skia prevents readonly shares.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.