[GH-ISSUE #5934] Restart Server can wedge the old process or orphan the new one, both reading as a zombie install #3281

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

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

Originally assigned to: @SpicyMarinara on GitHub.

The Restart Server button in Advanced Settings can leave the engine in one of two bad
states, both observed on the same machine in one evening. Either the old process wedges
mid-shutdown — a libuv assertion fires on Windows (Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), file src\win\async.c, line 76) and the process
stays half-alive holding port 7860 and the storage writer lease, so every later start
fails with StorageWriterLeaseError naming the wedged PID and the launcher reports
"port already in use" — or the restart's replacement wins the race and keeps serving,
but as an orphan with no console window anywhere, so the user sees a launcher window
showing the loser's death (Server exited unexpectedly) while a healthy server they
cannot see or stop keeps running underneath. From the user's chair both read as "the
restart made a zombie."

Both shapes were captured live. Shape one: a process bound to 7860 answering nothing
for five seconds, killed manually to free the launcher. Shape two: PID 28120, parent
long dead, serving HTTP 200 in under three milliseconds with no window — while the
launcher's fresh boot printed the writer-lease refusal against it and exited. The
lease guard behaved correctly in both cases; the restart orchestration is what leaves
overlapping processes.

Why it matters. Restart Server is the recovery button — it is pressed exactly when the
user already thinks something is wrong, and today it can convert a working install into
one that "won't start" until someone finds and kills an invisible process. The
downgrade-guarded auto-update path makes this worse for source installs: the launcher
window fills with an unrelated storage-format block, so the real failure is easy to
misread.

The smallest honest fix has two halves. The shutdown half already exists: the bounded
close in #5863 (4s sever, 8s forced exit) turns the wedged-mid-close shape into an
at-most-8-second wait, and this issue is a second live reproduction in its favor. The
orchestration half is the restart flow itself: it should wait for the old process to
demonstrably release the port and writer lease before spawning the replacement (or
supervise the replacement under the same console/parent so it can never orphan), and a
replacement that loses the lease race should say which PID holds it and offer to end
it, rather than dying into a "press any key" window.

Originally created by @kolacheee on GitHub (Sep 7, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5934 Originally assigned to: @SpicyMarinara on GitHub. The Restart Server button in Advanced Settings can leave the engine in one of two bad states, both observed on the same machine in one evening. Either the old process wedges mid-shutdown — a libuv assertion fires on Windows (`Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), file src\win\async.c, line 76`) and the process stays half-alive holding port 7860 and the storage writer lease, so every later start fails with `StorageWriterLeaseError` naming the wedged PID and the launcher reports "port already in use" — or the restart's replacement wins the race and keeps serving, but as an orphan with no console window anywhere, so the user sees a launcher window showing the loser's death (`Server exited unexpectedly`) while a healthy server they cannot see or stop keeps running underneath. From the user's chair both read as "the restart made a zombie." Both shapes were captured live. Shape one: a process bound to 7860 answering nothing for five seconds, killed manually to free the launcher. Shape two: PID 28120, parent long dead, serving HTTP 200 in under three milliseconds with no window — while the launcher's fresh boot printed the writer-lease refusal against it and exited. The lease guard behaved correctly in both cases; the restart orchestration is what leaves overlapping processes. Why it matters. Restart Server is the recovery button — it is pressed exactly when the user already thinks something is wrong, and today it can convert a working install into one that "won't start" until someone finds and kills an invisible process. The downgrade-guarded auto-update path makes this worse for source installs: the launcher window fills with an unrelated storage-format block, so the real failure is easy to misread. The smallest honest fix has two halves. The shutdown half already exists: the bounded close in #5863 (4s sever, 8s forced exit) turns the wedged-mid-close shape into an at-most-8-second wait, and this issue is a second live reproduction in its favor. The orchestration half is the restart flow itself: it should wait for the old process to demonstrably release the port and writer lease before spawning the replacement (or supervise the replacement under the same console/parent so it can never orphan), and a replacement that loses the lease race should say which PID holds it and offer to end it, rather than dying into a "press any key" window.
bsakaguchi 2026-10-21 06:01:38 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 8, 2026):

@SpicyMarinara (Codex) is handling this issue in the maintainer-requested Issue Sweep PR #5962. Existing implementation PRs, draft PRs and issue-linked branches were checked before starting. The fix will reuse existing code and include focused regression proof; this comment records ownership, not completion.

<!-- gh-comment-id:5585131496 --> @SpicyMarinara commented on GitHub (Sep 8, 2026): @SpicyMarinara (Codex) is handling this issue in the maintainer-requested Issue Sweep PR #5962. Existing implementation PRs, draft PRs and issue-linked branches were checked before starting. The fix will reuse existing code and include focused regression proof; this comment records ownership, not completion.
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#3281
No description provided.