Skip to content

fix(server): sync all written files to disk#26939

Open
uhthomas wants to merge 2 commits intomainfrom
uhthomas/fix-server-fsync-all
Open

fix(server): sync all written files to disk#26939
uhthomas wants to merge 2 commits intomainfrom
uhthomas/fix-server-fsync-all

Conversation

@uhthomas
Copy link
Copy Markdown
Collaborator

Description

Add flush/fsync to all file write paths including thumbnails, transcoded videos, exif writes, file copies, and backups.

See #26881 for more discussion. These changes have been split out so that the most important changes can be merged without delay (syncing uploaded files).

How Has This Been Tested?

N/A

Checklist:

  • I have carefully read CONTRIBUTING.md
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

N/A

Ensure that all files are flushed after they've been written.

At current, files are not explicitly flushed to disk, which can cause
data corruption. In extreme circumstances, it's possible that uploaded
files may not ever be persisted at all.
Add flush/fsync to all file write paths including thumbnails, transcoded
videos, exif writes, file copies, and backups.
@uhthomas uhthomas changed the title Uhthomas/fix server fsync all fix(server): sync all written files to disk Mar 15, 2026
@platima
Copy link
Copy Markdown

platima commented Mar 16, 2026

Testing performance this morning with small and large JPGs across local SSD and NFS enterprise HDD storage.

@platima
Copy link
Copy Markdown

platima commented Mar 16, 2026

Testing this now, with read cache enabled so that we're focusing purely on the difference with thumbnail generation.

Have deployed the stack directly on the NAS itself so it's local storage.

Doing three runs of each to get firm numbers compared to vanilla v2.5.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants