ReviewOS

stacks/rpx

stopAll() logs a false 'did not become ready within 120s' for every booting site

#2272
Closed chris opened this 10 days ago ·
10 days ago

Summary

driveReadiness in packages/rpx/src/site-supervisor.ts treats a deliberate shutdown as a readiness failure. Its polling while loop exits when this.stopped becomes true, then falls through to the failure call at line 326:

fail(state, 'did not become ready within 120s')

So every stopAll() logs a bogus timeout warning, roughly one poll interval later, for each site that was still booting. Nothing actually timed out — the supervisor was asked to stop.

Impact

Product: shutdown reports a false failure for any site that had not finished booting. Anyone reading logs after a restart sees did not become ready within 120s for sites that were fine.

Tests: the warn is emitted after the test file that triggered it has ended, so it is attributed to whichever file runs next. It currently prints under proxy-handler.test.ts: in a normal run, which is pure noise pointing at an innocent file. This was some of the misleading signal I worked through while diagnosing #2267.

It cannot flip an assertion today only because sni-memory.test.ts is the sole file spying on log, its spy windows are synchronous, and it happens to run before site-supervisor.test.ts. Swap those two in the file order and the exact-count assertions at sni-memory.test.ts:41, :55 and :84 become flaky.

Fix

Guard the post-loop failure so a stop is not reported as a timeout — return early when this.stopped is set, rather than falling through to fail(...).

Found while auditing the suite after #2267. Related: #2270 (cross-file mock leakage), and the untracked supervisor in the resource-leak issue.

Sign in to comment on this issue.