Hot reload during a save can delete assets the old load is committing #10

Open
opened 2026-10-07 00:53:53 +02:00 by kyuubi · 0 comments
Owner

A hot reload while a save, copy or move is running leaves the old load's code finishing it. Each load has its own AssetStore and its own store lock, so the old commit and the new load's clean-up don't exclude each other.

Two ways that can lose assets:

  • The new load's first clean-up sweeps store files no indexed item uses. Assets the old load has just split into the store, before its item file is in place, look unused and get deleted.
  • Deleting or saving over an item in the new load releases assets whose last indexed user is gone. If the old load's incoming item reuses one of them ("N were stored already"), it is deleted before that item file lands.

Either way the item is written without assets it needs, and a move then deletes the cloud original.

Seen as a risk on 2026-10-07: 0.7.7 and 0.7.8 were hot-loaded while a 0.7.6 move was running. Neither sweep deleted anything (no "Deleted N asset store files" line), and the move had not committed yet.

Options

  • A lock both loads can see, such as a lock file in the store, instead of a per-object SemaphoreSlim
  • The sweep skips store files newer than a few minutes
A hot reload while a save, copy or move is running leaves the old load's code finishing it. Each load has its own `AssetStore` and its own store lock, so the old commit and the new load's clean-up don't exclude each other. Two ways that can lose assets: - The new load's first clean-up sweeps store files no indexed item uses. Assets the old load has just split into the store, before its item file is in place, look unused and get deleted. - Deleting or saving over an item in the new load releases assets whose last indexed user is gone. If the old load's incoming item reuses one of them ("N were stored already"), it is deleted before that item file lands. Either way the item is written without assets it needs, and a move then deletes the cloud original. Seen as a risk on 2026-10-07: 0.7.7 and 0.7.8 were hot-loaded while a 0.7.6 move was running. Neither sweep deleted anything (no "Deleted N asset store files" line), and the move had not committed yet. ## Options - [ ] A lock both loads can see, such as a lock file in the store, instead of a per-object `SemaphoreSlim` - [ ] The sweep skips store files newer than a few minutes
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kyuubi/ResoLocalStorage#10
No description provided.