Skip to content

fix: allow persistence-safe shutdown budget - #9426

Open
Xipong wants to merge 1 commit into
jo-inc:masterfrom
Xipong:fix/persistence-shutdown-budget
Open

fix: allow persistence-safe shutdown budget#9426
Xipong wants to merge 1 commit into
jo-inc:masterfrom
Xipong:fix/persistence-shutdown-budget

Conversation

@Xipong

@Xipong Xipong commented Aug 19, 2026

Copy link
Copy Markdown

Summary

  • replace the fixed 10-second forced-exit watchdog with centralized CAMOFOX_SHUTDOWN_TIMEOUT_MS configuration
  • use a persistence-safe 45-second default
  • reject zero, negative, non-integer, infinite, unsafe-integer, and above-Node-timer-limit values by falling back to the default
  • forward the setting through the existing explicit child-process environment whitelist

Motivation

Graceful shutdown awaits server:shutdown listeners before closing browser contexts. The persistence plugin uses that window to checkpoint storage state, optionally including IndexedDB. With multiple active sessions or larger IndexedDB state, the existing 10-second watchdog can terminate the process while those awaited checkpoints are still running.

The watchdog remains bounded and armed before shutdown work begins; only its validated budget becomes configurable.

Verification

  • npm test -- --runInBand tests/unit/config.test.js tests/unit/shutdownBudget.test.js tests/unit/serverShutdownEvent.test.js plugins/persistence/plugin.test.js plugins/persistence/persistence.test.js
  • npm run build
  • npm run test:mcp
  • CI-equivalent unit + plugin suite: 59 suites / 786 tests passed
  • node --check server.js

The new regression tests were added before the implementation and failed while gracefulShutdown() still used the fixed 10-second value.

Scope

This does not change checkpoint ordering, make persistence concurrent, enable IndexedDB by default, or alter normal runtime behavior. The only user-visible difference is the bounded wait during shutdown.

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.

1 participant