Skip to content

fix(core): handle shutdown lock cleanup rejection#961

Open
realfishsam wants to merge 1 commit into
mainfrom
fix/easy-server-shutdown-rejection
Open

fix(core): handle shutdown lock cleanup rejection#961
realfishsam wants to merge 1 commit into
mainfrom
fix/easy-server-shutdown-rejection

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

  • make signal shutdown handler synchronous so Node does not ignore a returned rejecting Promise
  • catch lock-file cleanup failures, log them, and still exit with the intended success code
  • guard against duplicate SIGTERM/SIGINT shutdown execution

Fixes #720

Test Plan

  • npm run build --workspace=pmxt-core

@realfishsam

Copy link
Copy Markdown
Contributor Author

PR Review: PASS (NOT VERIFIED)

What This Does

Makes server shutdown lock-file cleanup rejection-safe and idempotent so signal handling still exits after cleanup failures.

Blast Radius

Core server startup/shutdown path only.

Consumer Verification

Before (base branch):
Base shutdown awaited lockFile.remove() directly before process.exit(0), so a rejected cleanup could prevent clean process exit.

After (PR branch):
PR uses a shuttingDown guard and always exits in .finally() after logging cleanup errors. Core build/Jest passed (24 suites, 644 tests); root verification then hit missing pytest.

Test Results

  • Build: PASS
  • Unit tests: CORE PASS (24 suites, 644 tests; root verification blocked by missing pytest)
  • Server starts: PASS during root verification
  • E2E smoke: NOT VERIFIED with signal-level process test

Findings

No blocking findings.

PMXT Pipeline Check

  • Field propagation (3-layer): N/A
  • OpenAPI sync: N/A
  • Financial precision: N/A
  • Type safety: OK
  • Auth safety: N/A

Semver Impact

patch -- server shutdown robustness fix.

Risk

Actual SIGINT/SIGTERM behavior with a failing lock-file removal was not reproduced; conclusion is from code path and passing build/tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unhandled async: server/index.ts — async shutdown handler on SIGTERM/SIGINT; rejection prevents process.exit(0)

1 participant