[GH-ISSUE #5744] Writer lease with null hostId permanently blocks boot until manually deleted #3175

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

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

Originally assigned to: @Romuromylus on GitHub.

A file-backed-store writer lease whose record carries hostId: null can never be reclaimed, and it blocks server boot permanently until someone deletes the lease file by hand.

Observed on a v2.4.4 build (the eng-5405 checkout's packages/server/dist, source read at packages/server/src/db/file-backed-store.ts:1198-1209 in that tree — line numbers may have drifted on staging). writerLeaseBelongsToCurrentHost evaluates Boolean(CURRENT_HOST_ID && record.hostId === CURRENT_HOST_ID), so a lease record with a null hostId fails the comparison for every host, forever. Current builds write a proper hostId and self-reclaim fine — the poisonous records come from older builds or crash paths that persisted the lease without one.

How it was hit: a playtest data directory carried a stale lease from a force-killed process (PID long dead, lease dated two weeks back, hostId: null). Every subsequent boot refused with the lease-held error; the process it named no longer existed and no restart could ever clear it. Deleting the lease file per the error text resolved it, and the replacement lease self-reclaims normally.

Suggested shape of a fix: treat a null-hostId lease as reclaimable when it is provably stale (the same PID/age staleness test the reclaim path already trusts for same-host leases), or migrate null-hostId records on read. Either closes the trap; today the only exit is manual file surgery, which the error message does describe but which shouldn't be the only path out of a crashed older build.

Originally created by @kolacheee on GitHub (Sep 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5744 Originally assigned to: @Romuromylus on GitHub. A file-backed-store writer lease whose record carries `hostId: null` can never be reclaimed, and it blocks server boot permanently until someone deletes the lease file by hand. Observed on a v2.4.4 build (the `eng-5405` checkout's `packages/server/dist`, source read at `packages/server/src/db/file-backed-store.ts:1198-1209` in that tree — line numbers may have drifted on staging). `writerLeaseBelongsToCurrentHost` evaluates `Boolean(CURRENT_HOST_ID && record.hostId === CURRENT_HOST_ID)`, so a lease record with a null `hostId` fails the comparison for every host, forever. Current builds write a proper `hostId` and self-reclaim fine — the poisonous records come from older builds or crash paths that persisted the lease without one. How it was hit: a playtest data directory carried a stale lease from a force-killed process (PID long dead, lease dated two weeks back, `hostId: null`). Every subsequent boot refused with the lease-held error; the process it named no longer existed and no restart could ever clear it. Deleting the lease file per the error text resolved it, and the replacement lease self-reclaims normally. Suggested shape of a fix: treat a null-`hostId` lease as reclaimable when it is provably stale (the same PID/age staleness test the reclaim path already trusts for same-host leases), or migrate null-`hostId` records on read. Either closes the trap; today the only exit is manual file surgery, which the error message does describe but which shouldn't be the only path out of a crashed older build.
bsakaguchi 2026-10-21 06:00:14 +07:00
Author
Owner

@Romuromylus commented on GitHub (Sep 3, 2026):

Fixed by #5799, squash-merged to staging as 7195a3f5ab. A writer lease with hostId: null is now reclaimed on its own when the data directory sits on a filesystem only this machine can mount: an earlier boot or the container liveness check always counts, and the exited or reused PID checks count once the lease records the same PID namespace. Leases on network or shareable storage keep the manual removal path described in the error. Translated troubleshooting docs are tracked in #5800.

<!-- gh-comment-id:5520146224 --> @Romuromylus commented on GitHub (Sep 3, 2026): Fixed by #5799, squash-merged to staging as 7195a3f5ab199c9cc8fec17198318a4168728e70. A writer lease with `hostId: null` is now reclaimed on its own when the data directory sits on a filesystem only this machine can mount: an earlier boot or the container liveness check always counts, and the exited or reused PID checks count once the lease records the same PID namespace. Leases on network or shareable storage keep the manual removal path described in the error. Translated troubleshooting docs are tracked in #5800.
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#3175
No description provided.