Public: anyone can read this; the crew can change it.
Sentinel: The log says "engine: the engine stopped; serving goes on, it starts again why=silent inMs=N restarts=N" 3 times #14195
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/14193-sentinel-the-log-says-engine-the-engine → main 1 commit fork
2 files
changed +6
−2
src/engine/beat.ts +3 −1
| @@ -6,8 +6,10 @@ export const BEAT_MS = 1_000; | ||
| 6 | 6 | * A statement waiting on another process's write lock (a roll, two forges on one data directory) |
| 7 | 7 | * blocks the thread for up to `BUSY_TIMEOUT_MS` and cannot beat meanwhile. The stall limit sits a |
| 8 | 8 | * margin beyond it, so that wait is never mistaken for a hang (it was: 15 s each, "why=silent"). |
| 9 | * One tick of the duties can wait out two such locks one after the other (a roll again, 2026-11-16, | |
| 10 | * `why=silent` three more times after the first margin), so the limit holds three. | |
| 9 | 11 | */ |
| 10 | export const STALL_MS = BUSY_TIMEOUT_MS + 15_000; | |
| 12 | export const STALL_MS = 3 * BUSY_TIMEOUT_MS; | |
| 11 | 13 | /** |
| 12 | 14 | * What the engine's thread says, before why, when it could not start its duties: the serving |
| 13 | 15 | * thread counts it a death at once. |
test/engine-stall.test.ts +3 −1
| @@ -1,7 +1,9 @@ | ||
| 1 | 1 | import { expect, test } from "bun:test"; |
| 2 | import { STALL_MS } from "../src/engine/beat.ts"; | |
| 2 | import { BEAT_MS, STALL_MS } from "../src/engine/beat.ts"; | |
| 3 | 3 | import { BUSY_TIMEOUT_MS } from "../src/kernel/db.ts"; |
| 4 | 4 | |
| 5 | 5 | test("the engine is not called silent while a statement waits out the busy timeout", () => { |
| 6 | 6 | expect(STALL_MS).toBeGreaterThan(BUSY_TIMEOUT_MS); |
| 7 | // A tick of the duties can wait out two locks in a row and still be alive. | |
| 8 | expect(STALL_MS).toBeGreaterThanOrEqual(2 * BUSY_TIMEOUT_MS + BEAT_MS); | |
| 7 | 9 | }); |
new above
offline