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 #14023
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/14020-sentinel-the-log-says-engine-the-engine → main 1 commit fork
3 files
changed +16
−2
src/engine/beat.ts +8 −1
| @@ -1,6 +1,13 @@ | ||
| 1 | import { BUSY_TIMEOUT_MS } from "../kernel/db.ts"; | |
| 2 | ||
| 1 | 3 | /** How often the engine says it is alive, and how long without it before the serving thread ends it (`host.ts`). */ |
| 2 | 4 | export const BEAT_MS = 1_000; |
| 3 | export const STALL_MS = 15_000; | |
| 5 | /** | |
| 6 | * A statement waiting on another process's write lock (a roll, two forges on one data directory) | |
| 7 | * blocks the thread for up to `BUSY_TIMEOUT_MS` and cannot beat meanwhile. The stall limit sits a | |
| 8 | * margin beyond it, so that wait is never mistaken for a hang (it was: 15 s each, "why=silent"). | |
| 9 | */ | |
| 10 | export const STALL_MS = BUSY_TIMEOUT_MS + 15_000; | |
| 4 | 11 | /** |
| 5 | 12 | * What the engine's thread says, before why, when it could not start its duties: the serving |
| 6 | 13 | * thread counts it a death at once. |
src/kernel/db.ts +1 −1
| @@ -21,7 +21,7 @@ const log = createLog("db"); | ||
| 21 | 21 | * in milliseconds. Failing a request that would have succeeded after a 3ms |
| 22 | 22 | * wait is the worse outcome by a wide margin. |
| 23 | 23 | */ |
| 24 | const BUSY_TIMEOUT_MS = 15_000; | |
| 24 | export const BUSY_TIMEOUT_MS = 15_000; | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Pages the index keeps hot. Negative means KiB rather than pages, so this |
test/engine-stall.test.ts added +7
| @@ -0,0 +1,7 @@ | ||
| 1 | import { expect, test } from "bun:test"; | |
| 2 | import { STALL_MS } from "../src/engine/beat.ts"; | |
| 3 | import { BUSY_TIMEOUT_MS } from "../src/kernel/db.ts"; | |
| 4 | ||
| 5 | test("the engine is not called silent while a statement waits out the busy timeout", () => { | |
| 6 | expect(STALL_MS).toBeGreaterThan(BUSY_TIMEOUT_MS); | |
| 7 | }); |
new above
offline