[GH-ISSUE #6083] [Issue]: Full backups include storage/.writer-lease/owner.json, which blocks startup after a manual restore #3374

Closed
opened 2026-10-21 06:02:27 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SonaGat3 on GitHub (Sep 12, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6083

Summary

Download Backup and the automatic backup archive storage/.writer-lease/owner.json, the per-process writer lease record. It is runtime state, not user data. Restoring the archive by hand (the "raw filesystem backup for manual recovery" described in the archive's own RESTORE.txt) carries the stale lease into the new data folder, and on another machine the server refuses to start until the user deletes the directory.

Expected behavior

The backup omits storage/.writer-lease/ entirely, the same way the launcher's update snapshot already does since #6056 ("Nothing in the lease is user data, so leave the directory out entirely"). A restored data folder starts cleanly.

Actual behavior

Every full backup written on 2.4.5 contains <root>/storage/.writer-lease/owner.json (verified on a real Download Backup). After copying the folders back on a different machine, startup fails with:

Another Marinara Engine process (PID <pid>, host <old hostname>) may be using <path>. Close it before retrying. If it no longer exists, verify every process is stopped and remove only <path>/storage/.writer-lease.

The lease reclaim logic only treats a record as stale when it can prove the same host (machine ID, Termux home, or local-storage proof) and a different boot, a dead PID, or a refused liveness socket. A record written on another machine never qualifies, by design, so the documented "move to a new device" restore always ends in this error. A community user restoring a backup by hand hit exactly this and had to delete the directory before the server would start.

Steps to reproduce

  1. Click Download Backup while the server is running.
  2. Inspect the ZIP: marinara-backup-<timestamp>/storage/.writer-lease/owner.json is present.
  3. Copy the archive's folders into a fresh data folder on another machine and start Marinara.
  4. Startup stops with the writer lease error above.

Environment

  • Marinara Engine version: 2.4.5 (staging, 9bf5baaf0)
  • Install type: source (git checkout)
  • OS + version: Windows 10 22H2
  • Browser or app shell: n/a

Logs, screenshots, or video

See the startup error quoted above.

Additional context

Why this matters even though Import Profile is the expected restore path: the manual copy is the fallback the archive itself advertises in RESTORE.txt, and it is the only way back in whenever the in-app import cannot be used, for example an install too broken to reach Settings, a version whose importer rejects the archive (as happened with the .native markers before #5587, and happens today with backups over 2 GiB, which the current upload cap rejects before inspecting them), or a migration to a machine that has not run Marinara yet. A backup that only restores cleanly through the importer is a weaker backup than the docs promise.

collectDirectoryZipSources in packages/server/src/routes/backup.routes.ts walks every directory in BACKUP_DIRS, including storage, and keeps every regular file. The lease's live.sock is skipped only because it is a socket, so owner.json is the one file that leaks. A one-line exclusion of .writer-lease in that walk (mirroring scripts/protect-launcher-data.mjs) would close it. The in-app Import Profile path is not affected, because it merges tables from the profile manifest and never copies storage/ raw files.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SonaGat3 on GitHub (Sep 12, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6083 ## Summary **Download Backup** and the automatic backup archive `storage/.writer-lease/owner.json`, the per-process writer lease record. It is runtime state, not user data. Restoring the archive by hand (the "raw filesystem backup for manual recovery" described in the archive's own `RESTORE.txt`) carries the stale lease into the new data folder, and on another machine the server refuses to start until the user deletes the directory. ## Expected behavior The backup omits `storage/.writer-lease/` entirely, the same way the launcher's update snapshot already does since #6056 ("Nothing in the lease is user data, so leave the directory out entirely"). A restored data folder starts cleanly. ## Actual behavior Every full backup written on 2.4.5 contains `<root>/storage/.writer-lease/owner.json` (verified on a real Download Backup). After copying the folders back on a different machine, startup fails with: Another Marinara Engine process (PID <pid>, host <old hostname>) may be using <path>. Close it before retrying. If it no longer exists, verify every process is stopped and remove only <path>/storage/.writer-lease. The lease reclaim logic only treats a record as stale when it can prove the same host (machine ID, Termux home, or local-storage proof) and a different boot, a dead PID, or a refused liveness socket. A record written on another machine never qualifies, by design, so the documented "move to a new device" restore always ends in this error. A community user restoring a backup by hand hit exactly this and had to delete the directory before the server would start. ## Steps to reproduce 1. Click **Download Backup** while the server is running. 2. Inspect the ZIP: `marinara-backup-<timestamp>/storage/.writer-lease/owner.json` is present. 3. Copy the archive's folders into a fresh data folder on another machine and start Marinara. 4. Startup stops with the writer lease error above. ## Environment - Marinara Engine version: 2.4.5 (`staging`, `9bf5baaf0`) - Install type: source (git checkout) - OS + version: Windows 10 22H2 - Browser or app shell: n/a ## Logs, screenshots, or video See the startup error quoted above. ## Additional context Why this matters even though **Import Profile** is the expected restore path: the manual copy is the fallback the archive itself advertises in `RESTORE.txt`, and it is the only way back in whenever the in-app import cannot be used, for example an install too broken to reach Settings, a version whose importer rejects the archive (as happened with the `.native` markers before #5587, and happens today with backups over 2 GiB, which the current upload cap rejects before inspecting them), or a migration to a machine that has not run Marinara yet. A backup that only restores cleanly through the importer is a weaker backup than the docs promise. `collectDirectoryZipSources` in `packages/server/src/routes/backup.routes.ts` walks every directory in `BACKUP_DIRS`, including `storage`, and keeps every regular file. The lease's `live.sock` is skipped only because it is a socket, so `owner.json` is the one file that leaks. A one-line exclusion of `.writer-lease` in that walk (mirroring `scripts/protect-launcher-data.mjs`) would close it. The in-app **Import Profile** path is not affected, because it merges tables from the profile manifest and never copies `storage/` raw files. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:02:27 +07:00
Author
Owner

@SonaGat3 commented on GitHub (Sep 12, 2026):

Working on a PR for this.

<!-- gh-comment-id:5646581479 --> @SonaGat3 commented on GitHub (Sep 12, 2026): Working on a PR for this.
Sign in to join this conversation.
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
Pasta-Devs/Marinara-Engine#3374
No description provided.