[GH-ISSUE #5062] [Issue]: Orphaned dev server blocks the next launch with a storage writer lease #2802

Closed
opened 2026-10-21 05:55:49 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @SpicyMarinara on GitHub (Aug 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5062

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Stopping pnpm dev through a terminal, IDE, or supervisor can leave the nested tsx server alive. That orphan keeps the storage writer lease, so the next launch fails during bootstrap instead of opening Marinara Engine.

Expected behavior

Stopping a development session should terminate its complete server/client process trees. Starting pnpm dev while a healthy Marinara server is already running should reuse it and start the client without attempting a conflicting second storage writer.

Actual behavior

The dev supervisor signals only its immediate pnpm children. Nested watcher/server processes can survive and retain packages/server/data/storage/.writer-lease. A subsequent launch then exits with StorageWriterLeaseError: Another Marinara Engine process ... may be using .../storage.

Steps to reproduce

  1. Run pnpm dev.
  2. Send SIGTERM only to the node ./scripts/dev.mjs supervisor, as an IDE or parent process may do.
  3. Observe that the nested tsx watch, server, Vite, and esbuild descendants remain alive and the health endpoint still responds.
  4. Run pnpm dev again.
  5. Observe the second server fail on the existing storage writer lease.

Environment

  • Marinara Engine version: 2.4.3
  • Install type: source
  • OS + version: macOS
  • Browser or app shell: Not applicable; bootstrap fails before the client opens

Logs, screenshots, or video

StorageWriterLeaseError: Another Marinara Engine process (PID 25038, host mac.home) may be using packages/server/data/storage.

A focused local reproduction confirmed that terminating only the current dev supervisor left the entire descendant process group and /api/health server alive; terminating that process group stopped it.

Additional context

The storage lease itself is working as intended and must continue preventing concurrent writers. The fix belongs in the dev launcher lifecycle: own/terminate complete child process groups and safely reuse a verified healthy Marinara server on the configured port.

Follow-up to the storage writer safety introduced in #5014.

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 @SpicyMarinara on GitHub (Aug 15, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5062 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Stopping `pnpm dev` through a terminal, IDE, or supervisor can leave the nested `tsx` server alive. That orphan keeps the storage writer lease, so the next launch fails during bootstrap instead of opening Marinara Engine. ## Expected behavior Stopping a development session should terminate its complete server/client process trees. Starting `pnpm dev` while a healthy Marinara server is already running should reuse it and start the client without attempting a conflicting second storage writer. ## Actual behavior The dev supervisor signals only its immediate `pnpm` children. Nested watcher/server processes can survive and retain `packages/server/data/storage/.writer-lease`. A subsequent launch then exits with `StorageWriterLeaseError: Another Marinara Engine process ... may be using .../storage`. ## Steps to reproduce 1. Run `pnpm dev`. 2. Send `SIGTERM` only to the `node ./scripts/dev.mjs` supervisor, as an IDE or parent process may do. 3. Observe that the nested `tsx watch`, server, Vite, and esbuild descendants remain alive and the health endpoint still responds. 4. Run `pnpm dev` again. 5. Observe the second server fail on the existing storage writer lease. ## Environment - Marinara Engine version: 2.4.3 - Install type: source - OS + version: macOS - Browser or app shell: Not applicable; bootstrap fails before the client opens ## Logs, screenshots, or video ```text StorageWriterLeaseError: Another Marinara Engine process (PID 25038, host mac.home) may be using packages/server/data/storage. ``` A focused local reproduction confirmed that terminating only the current dev supervisor left the entire descendant process group and `/api/health` server alive; terminating that process group stopped it. ## Additional context The storage lease itself is working as intended and must continue preventing concurrent writers. The fix belongs in the dev launcher lifecycle: own/terminate complete child process groups and safely reuse a verified healthy Marinara server on the configured port. Follow-up to the storage writer safety introduced in #5014. ## 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 05:55:49 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Aug 15, 2026):

Claimed by @SpicyMarinara / Codex. I reproduced the orphaned-process path on macOS: sending SIGTERM only to the dev supervisor left its nested server/client process group alive and the health endpoint responding. I am preparing a focused launcher fix against staging that preserves the storage writer safety lock.

<!-- gh-comment-id:5302493333 --> @SpicyMarinara commented on GitHub (Aug 15, 2026): Claimed by @SpicyMarinara / Codex. I reproduced the orphaned-process path on macOS: sending SIGTERM only to the dev supervisor left its nested server/client process group alive and the health endpoint responding. I am preparing a focused launcher fix against staging that preserves the storage writer safety lock.
Author
Owner

@SpicyMarinara commented on GitHub (Aug 15, 2026):

Implemented in draft PR #5064. Proof: before the patch, supervisor-only SIGTERM left the nested server/client process group and health endpoint alive. After the patch, the same signal stopped both child groups and released .writer-lease. A second isolated dev launch reused the verified healthy server, started only a client, and kept exactly one server/storage writer. pnpm regression:launcher-update and pnpm check both pass locally.

<!-- gh-comment-id:5302520828 --> @SpicyMarinara commented on GitHub (Aug 15, 2026): Implemented in draft PR #5064. Proof: before the patch, supervisor-only SIGTERM left the nested server/client process group and health endpoint alive. After the patch, the same signal stopped both child groups and released .writer-lease. A second isolated dev launch reused the verified healthy server, started only a client, and kept exactly one server/storage writer. pnpm regression:launcher-update and pnpm check both pass locally.
Author
Owner

@SpicyMarinara commented on GitHub (Aug 15, 2026):

Recurrence confirmed and reclaimed by @SpicyMarinara / Codex. The original SIGINT/SIGTERM cleanup works, but a terminal hangup can kill scripts/dev.mjs while its detached pnpm -> tsx watch group survives. On macOS the orphaned group was reparented to PID 1, the server owner PID remained recorded in .writer-lease, and no healthy process listened on port 7860. I stopped only that verified orphan group and removed only its lease directory after confirming every member exited.

I am extending the focused launcher lifecycle coverage to SIGHUP/terminal-close cleanup; storage writer exclusion remains unchanged.

<!-- gh-comment-id:5303818450 --> @SpicyMarinara commented on GitHub (Aug 15, 2026): Recurrence confirmed and reclaimed by @SpicyMarinara / Codex. The original SIGINT/SIGTERM cleanup works, but a terminal hangup can kill `scripts/dev.mjs` while its detached `pnpm -> tsx watch` group survives. On macOS the orphaned group was reparented to PID 1, the server owner PID remained recorded in `.writer-lease`, and no healthy process listened on port 7860. I stopped only that verified orphan group and removed only its lease directory after confirming every member exited. I am extending the focused launcher lifecycle coverage to SIGHUP/terminal-close cleanup; storage writer exclusion remains unchanged.
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#2802
No description provided.