signalk-questdb 2.3.2 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/README.md +92 -0
- package/dist/container-env.js +14 -0
- package/dist/container-env.js.map +1 -1
- package/dist/drained.d.ts +2 -0
- package/dist/drained.js +22 -0
- package/dist/drained.js.map +1 -0
- package/dist/ilp-writer.d.ts +2 -0
- package/dist/ilp-writer.js +48 -13
- package/dist/ilp-writer.js.map +1 -1
- package/dist/image-refresh.d.ts +35 -0
- package/dist/image-refresh.js +118 -0
- package/dist/image-refresh.js.map +1 -0
- package/dist/index.js +464 -136
- package/dist/index.js.map +1 -1
- package/dist/query-client.d.ts +12 -1
- package/dist/query-client.js +37 -3
- package/dist/query-client.js.map +1 -1
- package/dist/questdb-ready.d.ts +21 -0
- package/dist/questdb-ready.js +35 -0
- package/dist/questdb-ready.js.map +1 -0
- package/dist/questdb-watchdog.d.ts +73 -0
- package/dist/questdb-watchdog.js +308 -0
- package/dist/questdb-watchdog.js.map +1 -0
- package/dist/watchdog-checks.d.ts +50 -0
- package/dist/watchdog-checks.js +279 -0
- package/dist/watchdog-checks.js.map +1 -0
- package/package.json +3 -3
- package/public/assets/AppPanel-C293yEHl.js +1 -0
- package/public/assets/{PluginConfigurationPanel-DR-y5e3d.js → PluginConfigurationPanel-7qfy8fIR.js} +1 -1
- package/public/assets/_virtual_mf-localSharedImportMap___mfe_internal__signalk_questdb__mf_owner__1-BH9mY6vj.js +1 -0
- package/public/assets/_virtual_mf___mfe_internal__signalk_questdb__mf_owner__97224418320974__loadShare__shared-H1lSL0nN.js +1 -0
- package/public/assets/{_virtual_mf___mfe_internal__signalk_questdb__mf_owner__196689844091135__prebuild__react__prebuild__-eQjVI-Oj.js → _virtual_mf___mfe_internal__signalk_questdb__mf_owner__97224418320974__prebuild__react__prebuild__-CTXDWPi7.js} +1 -1
- package/public/assets/{dist-C5M3fhBw.js → dist-BhVCbinB.js} +1 -1
- package/public/assets/helpers-CvnX61Ju.js +1 -0
- package/public/assets/{hostInit-3qWTwrQQ.js → hostInit-Ds8KD_fS.js} +1 -1
- package/public/assets/{index-D2iWq8nf.js → index-QJC86Uvi.js} +2 -2
- package/public/assets/{pendingShares-PvyVL1Z8.js → pendingShares-DemvETkM.js} +2 -2
- package/public/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/public/assets/{utils-v9GZlbdk.js → utils-D62kKhzq.js} +1 -1
- package/public/remoteEntry.js +2 -2
- package/public/assets/AppPanel-Fvhb8xTK.js +0 -1
- package/public/assets/_virtual_mf-localSharedImportMap___mfe_internal__signalk_questdb__mf_owner__1-BUtmcsA-.js +0 -1
- package/public/assets/_virtual_mf___mfe_internal__signalk_questdb__mf_owner__196689844091135__loadShare__shared-BRI06Lxu.js +0 -8
- package/public/assets/helpers-oIxDNnZJ.js +0 -1
package/dist/query-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-client.js","sourceRoot":"","sources":["../src/query-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAC7C,MAAM,aAAa,GAAG,2BAA2B,CAAC;AAClD,MAAM,aAAa,GACjB,qEAAqE,CAAC;AAcxE;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,CA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AAM,CAAC;YACP,oEAAoE;YACpE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,4EAA4E;IAC5E,0EAA0E;IAC1E,wEAAwE;IACxE,4EAA4E;IAC5E,6BAA6B;IAC7B,KAAK,CAAC,UAAU,CACd,KAAa,EACb,YAAmC,GAAG,EAAE,GAAE,CAAC;QAE3C,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QACzD,MAAM,IAAI,CAAC,IAAI,CAAC,wBAAwB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrE,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,MAAqB;QAC7B,2EAA2E;QAC3E,sEAAsE;QACtE,yEAAyE;QACzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO;YAAE,OAAO,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAChC,MAAM,GAAG,GAA4B,EAAE,CAAC;YACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACxC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface WaitForQuestdbOptions {
|
|
2
|
+
/** Ends the wait; the plugin stopping, or a purge taking over. */
|
|
3
|
+
signal: AbortSignal;
|
|
4
|
+
/** After each attempt QuestDB did not answer, with the wait before the next. */
|
|
5
|
+
onAttemptFailed: (err: unknown, nextDelayMs: number, attempt: number) => void;
|
|
6
|
+
/** Before each attempt after the first; one that throws fails the attempt. */
|
|
7
|
+
beforeRetry?: () => Promise<void>;
|
|
8
|
+
attemptMs?: number;
|
|
9
|
+
pollMs?: number;
|
|
10
|
+
minDelayMs?: number;
|
|
11
|
+
maxDelayMs?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolves once QuestDB answers. Each attempt asks every `pollMs` for up to
|
|
15
|
+
* `attemptMs`, and one without an answer is tried again after a backoff, 15 s
|
|
16
|
+
* doubling to 120 s, for as long as the plugin runs: a QuestDB that comes up
|
|
17
|
+
* late, replaying its WAL say, or is restarted while the plugin starts, must
|
|
18
|
+
* not leave recording off until someone restarts the plugin. Rejects only
|
|
19
|
+
* when `signal` aborts.
|
|
20
|
+
*/
|
|
21
|
+
export declare function waitForQuestdb(isHealthy: () => Promise<boolean>, options: WaitForQuestdbOptions): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { retryForever } from "signalk-container-helper";
|
|
2
|
+
/** How long one attempt waits for QuestDB to answer, and how often it asks. */
|
|
3
|
+
const ATTEMPT_MS = 30_000;
|
|
4
|
+
const POLL_MS = 500;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves once QuestDB answers. Each attempt asks every `pollMs` for up to
|
|
7
|
+
* `attemptMs`, and one without an answer is tried again after a backoff, 15 s
|
|
8
|
+
* doubling to 120 s, for as long as the plugin runs: a QuestDB that comes up
|
|
9
|
+
* late, replaying its WAL say, or is restarted while the plugin starts, must
|
|
10
|
+
* not leave recording off until someone restarts the plugin. Rejects only
|
|
11
|
+
* when `signal` aborts.
|
|
12
|
+
*/
|
|
13
|
+
export async function waitForQuestdb(isHealthy, options) {
|
|
14
|
+
const { signal, attemptMs = ATTEMPT_MS, pollMs = POLL_MS } = options;
|
|
15
|
+
let attempts = 0;
|
|
16
|
+
await retryForever(async () => {
|
|
17
|
+
if (attempts++ > 0)
|
|
18
|
+
await options.beforeRetry?.();
|
|
19
|
+
const deadline = Date.now() + attemptMs;
|
|
20
|
+
while (!signal.aborted) {
|
|
21
|
+
if (await isHealthy())
|
|
22
|
+
return;
|
|
23
|
+
if (Date.now() >= deadline)
|
|
24
|
+
break;
|
|
25
|
+
await new Promise((resolve) => setTimeout(resolve, pollMs));
|
|
26
|
+
}
|
|
27
|
+
throw new Error("QuestDB did not answer");
|
|
28
|
+
}, {
|
|
29
|
+
signal,
|
|
30
|
+
minDelayMs: options.minDelayMs,
|
|
31
|
+
maxDelayMs: options.maxDelayMs,
|
|
32
|
+
onAttemptFailed: options.onAttemptFailed,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=questdb-ready.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"questdb-ready.js","sourceRoot":"","sources":["../src/questdb-ready.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,+EAA+E;AAC/E,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,MAAM,OAAO,GAAG,GAAG,CAAC;AAepB;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,SAAiC,EACjC,OAA8B;IAE9B,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,UAAU,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC;IACrE,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAM,YAAY,CAChB,KAAK,IAAI,EAAE;QACT,IAAI,QAAQ,EAAE,GAAG,CAAC;YAAE,MAAM,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QACxC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACvB,IAAI,MAAM,SAAS,EAAE;gBAAE,OAAO;YAC9B,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ;gBAAE,MAAM;YAClC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9D,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC,EACD;QACE,MAAM;QACN,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,eAAe,EAAE,OAAO,CAAC,eAAe;KACzC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type WatchdogReason = "out-of-memory" | "unresponsive";
|
|
2
|
+
export type WatchdogVerdict = {
|
|
3
|
+
state: "ok";
|
|
4
|
+
} | {
|
|
5
|
+
state: "skip";
|
|
6
|
+
why: string;
|
|
7
|
+
} | {
|
|
8
|
+
state: WatchdogReason;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
export type RestartOutcome = {
|
|
12
|
+
state: "answering";
|
|
13
|
+
} | {
|
|
14
|
+
state: "not-answering";
|
|
15
|
+
} | {
|
|
16
|
+
state: "called-off";
|
|
17
|
+
why: string;
|
|
18
|
+
};
|
|
19
|
+
export interface WatchdogDeps {
|
|
20
|
+
exclusive<T>(fn: () => Promise<T>): Promise<T>;
|
|
21
|
+
probe(): Promise<WatchdogVerdict>;
|
|
22
|
+
recentErrors(): Promise<string[]>;
|
|
23
|
+
restart(): Promise<RestartOutcome>;
|
|
24
|
+
log(msg: string): void;
|
|
25
|
+
status(msg: string): void;
|
|
26
|
+
recovered(): void;
|
|
27
|
+
notify(state: "alert" | "normal", message: string): void;
|
|
28
|
+
debug(msg: string): void;
|
|
29
|
+
}
|
|
30
|
+
export interface WatchdogOptions {
|
|
31
|
+
intervalMs?: number;
|
|
32
|
+
unresponsiveChecks?: number;
|
|
33
|
+
outOfMemoryChecks?: number;
|
|
34
|
+
minRestartGapMs?: number;
|
|
35
|
+
maxRestarts?: number;
|
|
36
|
+
restartWindowMs?: number;
|
|
37
|
+
failedRetryGapMs?: number;
|
|
38
|
+
now?: () => number;
|
|
39
|
+
wallNow?: () => number;
|
|
40
|
+
}
|
|
41
|
+
export declare function globalMemoryLimitMessage(text: string): string | null;
|
|
42
|
+
export declare function memoryLimitBytes(message: string): number | null;
|
|
43
|
+
export declare function heldAtLimit(usedBytes: number, limitBytes: number): boolean;
|
|
44
|
+
export declare function questdbErrorLines(lines: readonly string[], max?: number): string[];
|
|
45
|
+
export declare class QuestdbWatchdog {
|
|
46
|
+
private deps;
|
|
47
|
+
private timer;
|
|
48
|
+
private checking;
|
|
49
|
+
private stopped;
|
|
50
|
+
private failing;
|
|
51
|
+
private restarts;
|
|
52
|
+
private failedAt;
|
|
53
|
+
private heldBack;
|
|
54
|
+
private alerting;
|
|
55
|
+
private readonly intervalMs;
|
|
56
|
+
private readonly unresponsiveChecks;
|
|
57
|
+
private readonly outOfMemoryChecks;
|
|
58
|
+
private readonly minRestartGapMs;
|
|
59
|
+
private readonly maxRestarts;
|
|
60
|
+
private readonly restartWindowMs;
|
|
61
|
+
private readonly failedRetryGapMs;
|
|
62
|
+
private readonly now;
|
|
63
|
+
private readonly wallNow;
|
|
64
|
+
constructor(deps: WatchdogDeps, options?: WatchdogOptions);
|
|
65
|
+
private iso;
|
|
66
|
+
start(): void;
|
|
67
|
+
stop(): void;
|
|
68
|
+
get alertOutstanding(): boolean;
|
|
69
|
+
check(): Promise<void>;
|
|
70
|
+
private runCheck;
|
|
71
|
+
private restartFor;
|
|
72
|
+
private clearAlert;
|
|
73
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
// QuestDB watchdog: restarts a managed QuestDB container that has run out of
|
|
2
|
+
// memory or stopped answering, and says so before and after — in the server
|
|
3
|
+
// log with QuestDB's own message, on the plugin status, and as a Signal K
|
|
4
|
+
// notification.
|
|
5
|
+
//
|
|
6
|
+
// Background — how QuestDB runs out of memory without dying: QuestDB caps the
|
|
7
|
+
// native memory it tracks (90 % of the container limit by default) and fails
|
|
8
|
+
// any allocation past the cap with "global RSS memory limit exceeded". When a
|
|
9
|
+
// leak holds usage at the cap, every query that needs memory fails, the WAL
|
|
10
|
+
// apply job then suspends the tables, and in the end the HTTP server stops
|
|
11
|
+
// accepting connections. The JVM never exits, so the container's restart
|
|
12
|
+
// policy never acts, and nothing recovers short of a restart. Observed twice
|
|
13
|
+
// on QuestDB 9.4.3, whose HTTP query cache kept every cached GROUP BY's
|
|
14
|
+
// buffers at their peak (see QDB_HTTP_QUERY_CACHE_ENABLED in
|
|
15
|
+
// container-env.ts): 17 hours, then 4 hours, of recording lost before
|
|
16
|
+
// someone restarted it by hand.
|
|
17
|
+
//
|
|
18
|
+
// What counts:
|
|
19
|
+
// - out of memory: QuestDB reported its global limit, and its native memory
|
|
20
|
+
// is still at that limit at two checks in a row. A single large query that
|
|
21
|
+
// hits the limit frees what it held when it ends, and so does a client
|
|
22
|
+
// that keeps asking for one; a leak keeps the memory held. The per-query
|
|
23
|
+
// limit ("query memory limit exceeded") is not this: it fails one query
|
|
24
|
+
// and leaves the instance healthy.
|
|
25
|
+
// - unresponsive: the container is running but QuestDB has answered nothing
|
|
26
|
+
// for minutes, at `unresponsiveChecks` checks in a row. A busy QuestDB is
|
|
27
|
+
// not this: with one worker, a long statement holds up every query behind
|
|
28
|
+
// it, so a health check can time out while QuestDB is merely working.
|
|
29
|
+
// A container someone else stopped is left alone, unless the watchdog's
|
|
30
|
+
// own stop may be what keeps it down (watchdog-checks.ts).
|
|
31
|
+
//
|
|
32
|
+
// Restarts are bounded: at most one per `minRestartGapMs`, and at most
|
|
33
|
+
// `maxRestarts` within `restartWindowMs`. A restart that does not help would
|
|
34
|
+
// otherwise turn into a loop that takes recording down every few minutes.
|
|
35
|
+
// A restart that failed (its stop or start threw) counts against neither: it
|
|
36
|
+
// may have left the container stopped, and recording stays off until the
|
|
37
|
+
// container runs, so it is tried again `failedRetryGapMs` after it failed.
|
|
38
|
+
// The first failure is reported; the retries after it only in the debug log,
|
|
39
|
+
// until one gets through.
|
|
40
|
+
const DEFAULT_INTERVAL_MS = 60_000;
|
|
41
|
+
const DEFAULT_UNRESPONSIVE_CHECKS = 3;
|
|
42
|
+
const DEFAULT_OUT_OF_MEMORY_CHECKS = 2;
|
|
43
|
+
const DEFAULT_MIN_RESTART_GAP_MS = 15 * 60_000;
|
|
44
|
+
const DEFAULT_MAX_RESTARTS = 3;
|
|
45
|
+
const DEFAULT_RESTART_WINDOW_MS = 6 * 3_600_000;
|
|
46
|
+
const DEFAULT_FAILED_RETRY_GAP_MS = 5 * 60_000;
|
|
47
|
+
// QuestDB's message when the instance as a whole is at its memory cap
|
|
48
|
+
// (io.questdb.std.Unsafe). The same text in 9.x and 10.x.
|
|
49
|
+
const GLOBAL_LIMIT_RE = /global RSS memory limit exceeded[^"\n]*/;
|
|
50
|
+
// How close to the limit counts as held at it. A leak pins usage within a
|
|
51
|
+
// few hundred KiB of the limit (724,566,016 of 724,775,670 bytes on the
|
|
52
|
+
// boat); memory that a finished query freed drops far below.
|
|
53
|
+
const AT_LIMIT_FRACTION = 0.95;
|
|
54
|
+
// The part of a QuestDB error that names the global memory limit, or null.
|
|
55
|
+
// Errors reach the plugin wrapped ("QuestDB query failed (400): {...}"), so
|
|
56
|
+
// this cuts QuestDB's own sentence out of whatever surrounds it.
|
|
57
|
+
export function globalMemoryLimitMessage(text) {
|
|
58
|
+
const match = GLOBAL_LIMIT_RE.exec(text);
|
|
59
|
+
return match ? match[0].trim() : null;
|
|
60
|
+
}
|
|
61
|
+
// The limit in bytes that a global-limit message names (`RSS_MEM_LIMIT=`),
|
|
62
|
+
// or null.
|
|
63
|
+
export function memoryLimitBytes(message) {
|
|
64
|
+
const match = /RSS_MEM_LIMIT=(\d+)/.exec(message);
|
|
65
|
+
const bytes = match ? Number(match[1]) : NaN;
|
|
66
|
+
return Number.isSafeInteger(bytes) && bytes > 0 ? bytes : null;
|
|
67
|
+
}
|
|
68
|
+
// Whether native memory in use is still held at the limit.
|
|
69
|
+
export function heldAtLimit(usedBytes, limitBytes) {
|
|
70
|
+
return usedBytes >= limitBytes * AT_LIMIT_FRACTION;
|
|
71
|
+
}
|
|
72
|
+
// Error and critical lines of the engine log, newest last. With the stdout
|
|
73
|
+
// level at ERROR (container-env.ts) the log holds little else, but advisory
|
|
74
|
+
// lines still come through and say nothing about a failure.
|
|
75
|
+
export function questdbErrorLines(lines, max = 5) {
|
|
76
|
+
return lines
|
|
77
|
+
.filter((line) => /^\S+\s+[EC]\s/.test(line))
|
|
78
|
+
.slice(-max)
|
|
79
|
+
.map((line) => (line.length > 300 ? `${line.slice(0, 300)}…` : line));
|
|
80
|
+
}
|
|
81
|
+
const LABEL = {
|
|
82
|
+
"out-of-memory": "out of memory",
|
|
83
|
+
unresponsive: "not answering",
|
|
84
|
+
};
|
|
85
|
+
export class QuestdbWatchdog {
|
|
86
|
+
deps;
|
|
87
|
+
timer = null;
|
|
88
|
+
checking = false;
|
|
89
|
+
stopped = false;
|
|
90
|
+
// Checks in a row that found QuestDB failing, for either reason: a memory
|
|
91
|
+
// leak typically ends with QuestDB not answering at all, and the count
|
|
92
|
+
// must not start over when it does.
|
|
93
|
+
failing = 0;
|
|
94
|
+
restarts = [];
|
|
95
|
+
// When the last restart failed; null once one got through.
|
|
96
|
+
failedAt = null;
|
|
97
|
+
// Set once a held-back restart has been reported, so a long incident does
|
|
98
|
+
// not repeat the same report every minute.
|
|
99
|
+
heldBack = false;
|
|
100
|
+
// An alert is out that nobody has cleared yet.
|
|
101
|
+
alerting = false;
|
|
102
|
+
intervalMs;
|
|
103
|
+
unresponsiveChecks;
|
|
104
|
+
outOfMemoryChecks;
|
|
105
|
+
minRestartGapMs;
|
|
106
|
+
maxRestarts;
|
|
107
|
+
restartWindowMs;
|
|
108
|
+
failedRetryGapMs;
|
|
109
|
+
now;
|
|
110
|
+
wallNow;
|
|
111
|
+
constructor(deps, options = {}) {
|
|
112
|
+
this.deps = deps;
|
|
113
|
+
this.intervalMs = options.intervalMs ?? DEFAULT_INTERVAL_MS;
|
|
114
|
+
this.unresponsiveChecks = Math.max(1, options.unresponsiveChecks ?? DEFAULT_UNRESPONSIVE_CHECKS);
|
|
115
|
+
this.outOfMemoryChecks = Math.max(1, options.outOfMemoryChecks ?? DEFAULT_OUT_OF_MEMORY_CHECKS);
|
|
116
|
+
this.minRestartGapMs =
|
|
117
|
+
options.minRestartGapMs ?? DEFAULT_MIN_RESTART_GAP_MS;
|
|
118
|
+
this.maxRestarts = Math.max(1, options.maxRestarts ?? DEFAULT_MAX_RESTARTS);
|
|
119
|
+
this.restartWindowMs = options.restartWindowMs ?? DEFAULT_RESTART_WINDOW_MS;
|
|
120
|
+
this.failedRetryGapMs =
|
|
121
|
+
options.failedRetryGapMs ?? DEFAULT_FAILED_RETRY_GAP_MS;
|
|
122
|
+
this.now = options.now ?? (() => performance.now());
|
|
123
|
+
this.wallNow = options.wallNow ?? Date.now;
|
|
124
|
+
}
|
|
125
|
+
// The wall-clock time of a monotonic instant.
|
|
126
|
+
iso(at) {
|
|
127
|
+
return new Date(this.wallNow() - (this.now() - at)).toISOString();
|
|
128
|
+
}
|
|
129
|
+
start() {
|
|
130
|
+
this.stopped = false;
|
|
131
|
+
this.timer = setInterval(() => {
|
|
132
|
+
void this.check();
|
|
133
|
+
}, this.intervalMs);
|
|
134
|
+
}
|
|
135
|
+
// Ends monitoring. An alert that is still out is the caller's to clear (see
|
|
136
|
+
// `alertOutstanding`): this runs inside the plugin's teardown, which knows
|
|
137
|
+
// what to say.
|
|
138
|
+
stop() {
|
|
139
|
+
this.stopped = true;
|
|
140
|
+
if (this.timer) {
|
|
141
|
+
clearInterval(this.timer);
|
|
142
|
+
this.timer = null;
|
|
143
|
+
}
|
|
144
|
+
this.failing = 0;
|
|
145
|
+
}
|
|
146
|
+
get alertOutstanding() {
|
|
147
|
+
return this.alerting;
|
|
148
|
+
}
|
|
149
|
+
async check() {
|
|
150
|
+
if (this.checking || this.stopped)
|
|
151
|
+
return;
|
|
152
|
+
this.checking = true;
|
|
153
|
+
try {
|
|
154
|
+
await this.deps.exclusive(() => this.runCheck());
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
// A failed probe (QuestDB mid-restart, the runtime busy) must not end
|
|
158
|
+
// the interval.
|
|
159
|
+
this.deps.debug(`QuestDB watchdog check failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
this.checking = false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
async runCheck() {
|
|
166
|
+
if (this.stopped)
|
|
167
|
+
return;
|
|
168
|
+
const verdict = await this.deps.probe();
|
|
169
|
+
if (this.stopped)
|
|
170
|
+
return;
|
|
171
|
+
if (verdict.state === "skip") {
|
|
172
|
+
this.failing = 0;
|
|
173
|
+
this.deps.debug(`QuestDB watchdog: check skipped: ${verdict.why}`);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (verdict.state === "ok") {
|
|
177
|
+
this.failing = 0;
|
|
178
|
+
this.heldBack = false;
|
|
179
|
+
// The incident is over: the next one is reported afresh.
|
|
180
|
+
this.failedAt = null;
|
|
181
|
+
// QuestDB came back by itself: while a restart was held back, or after
|
|
182
|
+
// one that it did not answer at first.
|
|
183
|
+
this.clearAlert("QuestDB answers again.");
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const count = ++this.failing;
|
|
187
|
+
const needed = verdict.state === "out-of-memory"
|
|
188
|
+
? this.outOfMemoryChecks
|
|
189
|
+
: this.unresponsiveChecks;
|
|
190
|
+
this.deps.debug(`QuestDB watchdog: ${LABEL[verdict.state]} (${count}/${needed}): ${verdict.message}`);
|
|
191
|
+
if (count < needed)
|
|
192
|
+
return;
|
|
193
|
+
await this.restartFor(verdict.state, verdict.message);
|
|
194
|
+
}
|
|
195
|
+
async restartFor(reason, message) {
|
|
196
|
+
const now = this.now();
|
|
197
|
+
if (this.failedAt !== null && now - this.failedAt < this.failedRetryGapMs) {
|
|
198
|
+
// Reported with the failure; not a hold-back.
|
|
199
|
+
this.deps.debug(`QuestDB watchdog: ${LABEL[reason]}; the failed restart is tried ` +
|
|
200
|
+
`again at ${this.iso(this.failedAt + this.failedRetryGapMs)}`);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
this.restarts = this.restarts.filter((at) => now - at < this.restartWindowMs);
|
|
204
|
+
const last = this.restarts.at(-1);
|
|
205
|
+
const nextAllowed = Math.max(last !== undefined ? last + this.minRestartGapMs : now, this.restarts.length >= this.maxRestarts
|
|
206
|
+
? this.restarts[this.restarts.length - this.maxRestarts] +
|
|
207
|
+
this.restartWindowMs
|
|
208
|
+
: now);
|
|
209
|
+
if (nextAllowed > now) {
|
|
210
|
+
if (!this.heldBack) {
|
|
211
|
+
this.heldBack = true;
|
|
212
|
+
const text = `QuestDB is ${LABEL[reason]} again (${message}), but it was ` +
|
|
213
|
+
`restarted ${this.restarts.length} time(s) in the last ` +
|
|
214
|
+
`${Math.round(this.restartWindowMs / 3_600_000)} h; the next ` +
|
|
215
|
+
`restart is held back until ${this.iso(nextAllowed)}.`;
|
|
216
|
+
this.deps.log(`QuestDB watchdog: ${text}`);
|
|
217
|
+
this.deps.status(`QuestDB ${LABEL[reason]}; restart held back`);
|
|
218
|
+
this.alerting = true;
|
|
219
|
+
this.deps.notify("alert", text);
|
|
220
|
+
}
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
this.heldBack = false;
|
|
224
|
+
// The failure before this retry was reported, and its alert is still up.
|
|
225
|
+
const retrying = this.failedAt !== null;
|
|
226
|
+
if (retrying) {
|
|
227
|
+
this.deps.debug(`QuestDB watchdog: QuestDB is ${LABEL[reason]}: ${message}. ` +
|
|
228
|
+
`Retrying the restart that failed.`);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
let lines = [];
|
|
232
|
+
try {
|
|
233
|
+
lines = await this.deps.recentErrors();
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
// Best effort: the restart does not wait on the log.
|
|
237
|
+
}
|
|
238
|
+
if (this.stopped)
|
|
239
|
+
return;
|
|
240
|
+
this.deps.log(`QuestDB watchdog: QuestDB is ${LABEL[reason]}: ${message}. ` +
|
|
241
|
+
`Restarting the QuestDB container.` +
|
|
242
|
+
(lines.length > 0
|
|
243
|
+
? ` QuestDB's last errors: ${lines.join(" | ")}`
|
|
244
|
+
: ""));
|
|
245
|
+
this.deps.status(`QuestDB ${LABEL[reason]}: restarting the container`);
|
|
246
|
+
this.alerting = true;
|
|
247
|
+
this.deps.notify("alert", `QuestDB is ${LABEL[reason]} (${message}). Restarting the QuestDB ` +
|
|
248
|
+
`container; history is not recorded meanwhile.`);
|
|
249
|
+
}
|
|
250
|
+
this.restarts.push(now);
|
|
251
|
+
this.failing = 0;
|
|
252
|
+
let outcome;
|
|
253
|
+
try {
|
|
254
|
+
outcome = await this.deps.restart();
|
|
255
|
+
}
|
|
256
|
+
catch (err) {
|
|
257
|
+
this.restarts.pop();
|
|
258
|
+
// A call that ran to its deadline took that long to fail.
|
|
259
|
+
this.failedAt = this.now();
|
|
260
|
+
if (this.stopped)
|
|
261
|
+
return;
|
|
262
|
+
const failure = `restarting the QuestDB container failed: ${err instanceof Error ? err.message : String(err)}`;
|
|
263
|
+
if (retrying) {
|
|
264
|
+
this.deps.debug(`QuestDB watchdog: ${failure}`);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const text = `${failure}; trying again in ${Math.round(this.failedRetryGapMs / 60_000)} min`;
|
|
268
|
+
this.deps.log(`QuestDB watchdog: ${text}`);
|
|
269
|
+
this.deps.status(`QuestDB ${LABEL[reason]}: ${text}`);
|
|
270
|
+
this.deps.notify("alert", `QuestDB is ${LABEL[reason]}; ${text}.`);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (this.stopped)
|
|
274
|
+
return;
|
|
275
|
+
if (outcome.state === "called-off") {
|
|
276
|
+
// Nothing was restarted, so nothing counts against the limits. The
|
|
277
|
+
// alert stays: QuestDB is still failing, and the next check that finds
|
|
278
|
+
// it answering clears the alert and the status with it.
|
|
279
|
+
this.restarts.pop();
|
|
280
|
+
this.deps.log(`QuestDB watchdog: restart called off: ${outcome.why}.`);
|
|
281
|
+
this.deps.notify("alert", `QuestDB is ${LABEL[reason]} (${message}); the restart was called ` +
|
|
282
|
+
`off: ${outcome.why}.`);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
this.failedAt = null;
|
|
286
|
+
const seconds = Math.round((this.now() - now) / 1000);
|
|
287
|
+
if (outcome.state === "not-answering") {
|
|
288
|
+
const text = `restarted the QuestDB container after it was ${LABEL[reason]}, ` +
|
|
289
|
+
`but it does not answer yet (${seconds} s)`;
|
|
290
|
+
this.deps.log(`QuestDB watchdog: ${text}.`);
|
|
291
|
+
this.deps.status(`QuestDB ${LABEL[reason]}: ${text}`);
|
|
292
|
+
this.deps.notify("alert", `QuestDB ${text}.`);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
this.deps.log(`QuestDB watchdog: restarted the QuestDB container after it was ` +
|
|
296
|
+
`${LABEL[reason]}; it answers again after ${seconds} s.`);
|
|
297
|
+
this.clearAlert(`QuestDB was restarted at ${this.iso(now)} after it was ` +
|
|
298
|
+
`${LABEL[reason]} (${message}).`);
|
|
299
|
+
}
|
|
300
|
+
clearAlert(message) {
|
|
301
|
+
if (!this.alerting)
|
|
302
|
+
return;
|
|
303
|
+
this.alerting = false;
|
|
304
|
+
this.deps.recovered();
|
|
305
|
+
this.deps.notify("normal", message);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=questdb-watchdog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"questdb-watchdog.js","sourceRoot":"","sources":["../src/questdb-watchdog.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4EAA4E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AAC,GAAG,CAAC,qBAAqB,IAAI,GAAG,CAAC,CAAC;YAC5C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YACtD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,IAAI,GAAG,CAAC,CAAC;YAC9C,OAAO;QACT,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,CACX,iEAAiE;YAC/D,GAAG,KAAK,CAAC,MAAM,CAAC,4BAA4B,OAAO,KAAK,CAC3D,CAAC;QACF,IAAI,CAAC,UAAU,CACb,4BAA4B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB;YACvD,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,OAAO,IAAI,CACnC,CAAC;IACJ,CAAC;IAEO,UAAU,CAAC,OAAe;QAChC,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ContainerManagerApi } from "signalk-container-helper";
|
|
2
|
+
import type { QueryClient } from "./query-client.js";
|
|
3
|
+
import { type RestartOutcome, type WatchdogVerdict } from "./questdb-watchdog.js";
|
|
4
|
+
export interface WatchdogChecksDeps {
|
|
5
|
+
containers: Pick<ContainerManagerApi, "getState" | "stop" | "start">;
|
|
6
|
+
name: string;
|
|
7
|
+
client(): Pick<QueryClient, "health" | "exec"> | null;
|
|
8
|
+
busy(): string | null;
|
|
9
|
+
epoch(): number;
|
|
10
|
+
bumpEpoch(): void;
|
|
11
|
+
ended(): boolean;
|
|
12
|
+
endpoint(): string | null;
|
|
13
|
+
reconnectWriter(): void;
|
|
14
|
+
stops: {
|
|
15
|
+
pending: number;
|
|
16
|
+
};
|
|
17
|
+
now?: () => number;
|
|
18
|
+
timing?: Partial<WatchdogTiming>;
|
|
19
|
+
}
|
|
20
|
+
export interface WatchdogTiming {
|
|
21
|
+
silenceMs: number;
|
|
22
|
+
evidenceMs: number;
|
|
23
|
+
limitSilenceMs: number;
|
|
24
|
+
containerCallMs: number;
|
|
25
|
+
answerMs: number;
|
|
26
|
+
pollMs: number;
|
|
27
|
+
}
|
|
28
|
+
export declare class WatchdogChecks {
|
|
29
|
+
private deps;
|
|
30
|
+
private limit;
|
|
31
|
+
private answeredAt;
|
|
32
|
+
private seenEpoch;
|
|
33
|
+
private leftStopped;
|
|
34
|
+
private readonly now;
|
|
35
|
+
private readonly timing;
|
|
36
|
+
constructor(deps: WatchdogChecksDeps);
|
|
37
|
+
private ownStop;
|
|
38
|
+
noteResponse(): void;
|
|
39
|
+
noteErrorResponse(body: string): void;
|
|
40
|
+
noteSuspended(tables: readonly {
|
|
41
|
+
name: string;
|
|
42
|
+
errorMessage: string;
|
|
43
|
+
}[]): void;
|
|
44
|
+
private noteLimit;
|
|
45
|
+
private recentLimit;
|
|
46
|
+
private readState;
|
|
47
|
+
private memoryHeld;
|
|
48
|
+
probe(): Promise<WatchdogVerdict>;
|
|
49
|
+
restart(): Promise<RestartOutcome>;
|
|
50
|
+
}
|