@origintrail-official/dkg-storage 10.0.2 → 10.0.3

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.
@@ -22,22 +22,126 @@ export declare class OxigraphWorkerStore implements TripleStore {
22
22
  private nextId;
23
23
  private pending;
24
24
  private readonly operationTimeoutMs;
25
- /** Set once the worker thread has exited (graceful close, crash, or kill). */
25
+ /** Resolved path of the compiled worker impl; reused verbatim on respawn. */
26
+ private readonly workerPath;
27
+ /** Persistence file handed to every spawned worker (undefined = in-memory). */
28
+ private readonly persistPath;
29
+ /**
30
+ * Single source of truth for the store's high-level POLICY state (see
31
+ * WorkerLifecycle). It subsumes the former `respawnGaveUp` boolean (⇔ state
32
+ * === 'gave_up') and adds the terminal 'in_memory_lost' state that finding-1
33
+ * needs, so the give-up/close/data-lost verdicts can never disagree the way
34
+ * an ad-hoc cluster of interdependent booleans could. Set to 'live' the
35
+ * moment spawnWorker() arms a fresh thread; only ever moves along the
36
+ * documented transitions (every write is guarded — `setLifecycle` for the
37
+ * non-spawn hops and `markSpawnedLive` for the spawn → 'live' hop — so a
38
+ * terminal state can never silently reopen).
39
+ *
40
+ * `workerExited` below stays as a separate, lower-level FACT ("the current
41
+ * thread has exited") because it is genuinely orthogonal to policy: during a
42
+ * graceful close() the state is 'closing' while the thread is still alive and
43
+ * mid-flush, then the thread exits — same policy state, different fact. The
44
+ * old soup was the *interdependence* of workerExited + respawnGaveUp +
45
+ * respawnPromise + closePromise all having to agree; folding the policy half
46
+ * into one discriminated field removes that.
47
+ *
48
+ * The initializer is a pre-construction placeholder only: the constructor
49
+ * always calls spawnWorker() (whose `markSpawnedLive` accepts the
50
+ * non-terminal 'initializing' placeholder), so no op ever observes this
51
+ * value. 'initializing' is deliberately NON-terminal so the spawn guard can
52
+ * enforce terminal permanence uniformly — a placeholder of 'closed' (a
53
+ * terminal state) would have made the first legal spawn indistinguishable
54
+ * from illegally reopening a closed store.
55
+ */
56
+ private lifecycle;
57
+ /** Set once the CURRENT worker thread has exited (graceful close, crash, or kill); cleared by spawnWorker(). */
26
58
  private workerExited;
27
59
  /** Memoized close so repeat/concurrent close() calls share one teardown. */
28
60
  private closePromise;
61
+ /**
62
+ * In-flight replacement of a crashed worker. While set, NEW ops park on it
63
+ * (see callWithTimeout) instead of failing, so a request that races the
64
+ * respawn sees a slightly slower success rather than a spurious error.
65
+ * Null whenever a live worker is armed. Tracked separately from `lifecycle`
66
+ * because ops need the actual promise to await, not just the 'respawning' tag.
67
+ */
68
+ private respawnPromise;
69
+ /**
70
+ * How many respawned workers in a row died without answering a single op
71
+ * successfully. Reset to 0 by the first successful reply; feeds the backoff
72
+ * tier and the MAX_CONSECUTIVE_RESPAWNS give-up bound.
73
+ */
74
+ private consecutiveRespawnFailures;
29
75
  constructor(persistPath?: string, opts?: OxigraphWorkerStoreOptions);
76
+ /**
77
+ * The single writer for `this.lifecycle`. A typed setter (rather than raw
78
+ * field assignment scattered across the class) gives us one place to assert
79
+ * the invariant that matters: a TERMINAL state is a dead end. Without this
80
+ * guard a latent bug — a stray respawn resurrecting a `gave_up` store, or a
81
+ * crash handler firing after `close()` — could silently re-open a store the
82
+ * operator was told is gone, which is exactly the class of "healthy-looking
83
+ * but wrong" state finding 1 is about. If we ever try to leave a terminal
84
+ * state we throw loudly instead.
85
+ */
86
+ private setLifecycle;
87
+ /**
88
+ * The ONE guarded transition INTO 'live' — used by spawnWorker() for both the
89
+ * constructor's first spawn (from the 'initializing' placeholder) and a
90
+ * respawn (from 'respawning'). `setLifecycle` can't own this hop because
91
+ * entering 'live' is legal only from those two non-terminal states, but the
92
+ * terminal-permanence invariant must still hold: a spawn attempted after
93
+ * 'closed' / 'gave_up' / 'in_memory_lost' (e.g. a future respawn/close code
94
+ * path calling spawnWorker() by mistake) MUST throw rather than silently
95
+ * resurrect a store that promised it would never serve another op.
96
+ */
97
+ private markSpawnedLive;
98
+ /** True once an operator-initiated close() has begun (closing or closed). */
99
+ private get isClosing();
100
+ /**
101
+ * Create the worker thread and arm its lifecycle handlers. Shared by the
102
+ * constructor and by respawn() so a replacement worker is wired IDENTICALLY
103
+ * to the original — same impl path, same workerData, same handlers — and the
104
+ * OxigraphWorkerStore object keeps its identity, so every alias held across
105
+ * the daemon (routes, publisher, gossip ingest) transparently talks to the
106
+ * new thread. Each handler captures the worker it was armed for and no-ops
107
+ * if `this.worker` has since moved on, so a stale event from an
108
+ * already-replaced thread can never clobber the live one's state.
109
+ */
110
+ private spawnWorker;
111
+ /** Arm (at most one) background respawn; the policy lives in respawn(). */
112
+ private scheduleRespawn;
113
+ /**
114
+ * Replace a crashed worker with a fresh one: immediate first attempt, then
115
+ * capped backoff (RESPAWN_BACKOFF_MS) between consecutive attempts, giving
116
+ * up for good after MAX_CONSECUTIVE_RESPAWNS workers in a row die without
117
+ * serving a single successful op. Giving up latches the store closed —
118
+ * exactly the pre-recovery behaviour — but with a FATAL log telling the
119
+ * operator what happened and where to look, instead of the old silence.
120
+ */
121
+ private respawn;
30
122
  private call;
31
123
  /**
32
- * Post one op to the worker and await its reply, bounding the caller's wait by
33
- * `timeoutMs` (0 = wait indefinitely). The bound is per-CALLER: on timeout or
34
- * caller abort we reject and drop the pending entry, but the single-threaded worker is STILL
35
- * running the op — the late reply is then ignored (the message handler no-ops
36
- * on a missing id) rather than double-settling this promise. Only read-only
37
- * ops are ever given a non-zero timeout (see `call`), so a fired timeout is
38
- * always a determinate, side-effect-free failure.
124
+ * Post one op to the (live) worker and await its reply, bounding the caller's
125
+ * wait by `timeoutMs` (0 = wait indefinitely). The bound is per-CALLER: on
126
+ * timeout or caller abort we reject and drop the pending entry, but the
127
+ * single-threaded worker is STILL running the op — the late reply is then
128
+ * ignored (the message handler no-ops on a missing id) rather than
129
+ * double-settling this promise. Only read-only ops are ever given a non-zero
130
+ * timeout (see `call`), so a fired timeout is always a determinate,
131
+ * side-effect-free failure. If a crashed worker is being replaced, the op
132
+ * first parks on the respawn (the timeout starts only once it is actually
133
+ * posted — backoff is capped well below the default read bound anyway).
39
134
  */
40
135
  private callWithTimeout;
136
+ /**
137
+ * Wait out the in-flight respawn(s), then post as normal. A loop rather
138
+ * than a single await because the replacement worker can itself die before
139
+ * this op gets posted, arming a new respawnPromise. If the respawn gave up,
140
+ * postToWorker's workerExited guard turns this into the fail-fast closed
141
+ * error (with the crash-loop guidance appended).
142
+ */
143
+ private callAfterRespawn;
144
+ private postToWorker;
41
145
  insert(quads: Quad[]): Promise<void>;
42
146
  delete(quads: Quad[]): Promise<void>;
43
147
  deleteByPattern(pattern: Partial<Quad>): Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"oxigraph-worker.d.ts","sourceRoot":"","sources":["../../src/adapters/oxigraph-worker.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAgClG,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AA6BD,kEAAkE;AAClE,MAAM,WAAW,0BAA2B,SAAQ,KAAK;IACvD,IAAI,EAAE,4BAA4B,CAAC;IACnC,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,mBAAoB,YAAW,WAAW;IACrD,QAAQ,CAAC,iBAAiB,EAAG,eAAe,CAAU;IAEtD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,OAAO,CAAgF;IAC/F,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAC5C,8EAA8E;IAC9E,OAAO,CAAC,YAAY,CAAS;IAC7B,4EAA4E;IAC5E,OAAO,CAAC,YAAY,CAA8B;gBAEtC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,0BAA0B;IAkEnE,OAAO,CAAC,IAAI;I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;;OAMG;YACW,gBAAgB;IAU9B,OAAO,CAAC,YAAY;IAmGd,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IACpC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IACpC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAGxD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACrC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC;IAG9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAC5C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC5C,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1C,UAAU,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAGhE,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACxE,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAoBd,OAAO;CA4BtB"}
@@ -31,6 +31,32 @@ import { registerTripleStoreAdapter } from '../triple-store.js';
31
31
  * wedged worker there without inventing an indeterminate mutation outcome.
32
32
  */
33
33
  const DEFAULT_OPERATION_TIMEOUT_MS = 120_000;
34
+ /**
35
+ * Backoff (ms) before each consecutive respawn attempt after an UNEXPECTED
36
+ * worker exit: the first attempt is immediate (a one-off OOM/crash should
37
+ * recover with zero visible downtime), then 1s / 5s / 30s, capped at the last
38
+ * tier. The cap keeps a persistently-crashing worker (corrupt state, chronic
39
+ * OOM on load) from melting the node in a hot spawn/crash loop while still
40
+ * retrying often enough that a transient cause self-heals.
41
+ */
42
+ const RESPAWN_BACKOFF_MS = [0, 1_000, 5_000, 30_000];
43
+ /**
44
+ * Give-up bound: after this many CONSECUTIVE respawned workers die without
45
+ * serving a single successful op, stop respawning and latch the store closed
46
+ * (the pre-recovery behaviour) with fatal operator guidance. The counter
47
+ * resets on the first successful reply from a worker (see the message handler
48
+ * in spawnWorker), so occasional crashes days apart never accumulate here —
49
+ * only a genuine crash loop trips it.
50
+ */
51
+ const MAX_CONSECUTIVE_RESPAWNS = 5;
52
+ /** Unref'd sleep — a respawn backoff timer must not keep the process alive on its own. */
53
+ function sleep(ms) {
54
+ return new Promise((resolve) => {
55
+ const t = setTimeout(resolve, ms);
56
+ if (typeof t.unref === 'function')
57
+ t.unref();
58
+ });
59
+ }
34
60
  /**
35
61
  * Accept only a finite, non-negative override; otherwise fall back. The result
36
62
  * is floored to an INTEGER — the timeout is a millisecond count, so a fractional
@@ -55,16 +81,68 @@ function asAbortError(reason) {
55
81
  const READ_ONLY_METHODS = new Set([
56
82
  'query', 'hasGraph', 'listGraphs', 'countQuads',
57
83
  ]);
84
+ /** Terminal states: the store will never serve another op and never respawns. */
85
+ const TERMINAL = new Set([
86
+ 'closed', 'gave_up', 'in_memory_lost',
87
+ ]);
58
88
  export class OxigraphWorkerStore {
59
89
  queryCancellation = 'interruptible';
90
+ // Assigned by spawnWorker(), which the constructor always calls — hence the
91
+ // definite-assignment assertion instead of an initializer.
60
92
  worker;
61
93
  nextId = 0;
62
94
  pending = new Map();
63
95
  operationTimeoutMs;
64
- /** Set once the worker thread has exited (graceful close, crash, or kill). */
96
+ /** Resolved path of the compiled worker impl; reused verbatim on respawn. */
97
+ workerPath;
98
+ /** Persistence file handed to every spawned worker (undefined = in-memory). */
99
+ persistPath;
100
+ /**
101
+ * Single source of truth for the store's high-level POLICY state (see
102
+ * WorkerLifecycle). It subsumes the former `respawnGaveUp` boolean (⇔ state
103
+ * === 'gave_up') and adds the terminal 'in_memory_lost' state that finding-1
104
+ * needs, so the give-up/close/data-lost verdicts can never disagree the way
105
+ * an ad-hoc cluster of interdependent booleans could. Set to 'live' the
106
+ * moment spawnWorker() arms a fresh thread; only ever moves along the
107
+ * documented transitions (every write is guarded — `setLifecycle` for the
108
+ * non-spawn hops and `markSpawnedLive` for the spawn → 'live' hop — so a
109
+ * terminal state can never silently reopen).
110
+ *
111
+ * `workerExited` below stays as a separate, lower-level FACT ("the current
112
+ * thread has exited") because it is genuinely orthogonal to policy: during a
113
+ * graceful close() the state is 'closing' while the thread is still alive and
114
+ * mid-flush, then the thread exits — same policy state, different fact. The
115
+ * old soup was the *interdependence* of workerExited + respawnGaveUp +
116
+ * respawnPromise + closePromise all having to agree; folding the policy half
117
+ * into one discriminated field removes that.
118
+ *
119
+ * The initializer is a pre-construction placeholder only: the constructor
120
+ * always calls spawnWorker() (whose `markSpawnedLive` accepts the
121
+ * non-terminal 'initializing' placeholder), so no op ever observes this
122
+ * value. 'initializing' is deliberately NON-terminal so the spawn guard can
123
+ * enforce terminal permanence uniformly — a placeholder of 'closed' (a
124
+ * terminal state) would have made the first legal spawn indistinguishable
125
+ * from illegally reopening a closed store.
126
+ */
127
+ lifecycle = 'initializing';
128
+ /** Set once the CURRENT worker thread has exited (graceful close, crash, or kill); cleared by spawnWorker(). */
65
129
  workerExited = false;
66
130
  /** Memoized close so repeat/concurrent close() calls share one teardown. */
67
131
  closePromise = null;
132
+ /**
133
+ * In-flight replacement of a crashed worker. While set, NEW ops park on it
134
+ * (see callWithTimeout) instead of failing, so a request that races the
135
+ * respawn sees a slightly slower success rather than a spurious error.
136
+ * Null whenever a live worker is armed. Tracked separately from `lifecycle`
137
+ * because ops need the actual promise to await, not just the 'respawning' tag.
138
+ */
139
+ respawnPromise = null;
140
+ /**
141
+ * How many respawned workers in a row died without answering a single op
142
+ * successfully. Reset to 0 by the first successful reply; feeds the backoff
143
+ * tier and the MAX_CONSECUTIVE_RESPAWNS give-up bound.
144
+ */
145
+ consecutiveRespawnFailures = 0;
68
146
  constructor(persistPath, opts) {
69
147
  this.operationTimeoutMs = normalizeNonNegativeInt(opts?.operationTimeoutMs, DEFAULT_OPERATION_TIMEOUT_MS);
70
148
  // Resolve the worker impl with a small search path so this keeps
@@ -101,10 +179,86 @@ export class OxigraphWorkerStore {
101
179
  `directory. Run \`pnpm --filter @origintrail-official/dkg-storage build\` ` +
102
180
  `before using this adapter.`);
103
181
  }
104
- this.worker = new Worker(workerPath, {
105
- workerData: { persistPath },
182
+ this.workerPath = workerPath;
183
+ this.persistPath = persistPath;
184
+ this.spawnWorker();
185
+ }
186
+ /**
187
+ * The single writer for `this.lifecycle`. A typed setter (rather than raw
188
+ * field assignment scattered across the class) gives us one place to assert
189
+ * the invariant that matters: a TERMINAL state is a dead end. Without this
190
+ * guard a latent bug — a stray respawn resurrecting a `gave_up` store, or a
191
+ * crash handler firing after `close()` — could silently re-open a store the
192
+ * operator was told is gone, which is exactly the class of "healthy-looking
193
+ * but wrong" state finding 1 is about. If we ever try to leave a terminal
194
+ * state we throw loudly instead.
195
+ */
196
+ setLifecycle(next) {
197
+ if (this.lifecycle === next)
198
+ return;
199
+ if (TERMINAL.has(this.lifecycle)) {
200
+ throw new Error(`oxigraph-worker: illegal lifecycle transition ${this.lifecycle} → ${next} ` +
201
+ '(terminal states are permanent) — this is a bug in the respawn supervisor.');
202
+ }
203
+ this.lifecycle = next;
204
+ }
205
+ /**
206
+ * The ONE guarded transition INTO 'live' — used by spawnWorker() for both the
207
+ * constructor's first spawn (from the 'initializing' placeholder) and a
208
+ * respawn (from 'respawning'). `setLifecycle` can't own this hop because
209
+ * entering 'live' is legal only from those two non-terminal states, but the
210
+ * terminal-permanence invariant must still hold: a spawn attempted after
211
+ * 'closed' / 'gave_up' / 'in_memory_lost' (e.g. a future respawn/close code
212
+ * path calling spawnWorker() by mistake) MUST throw rather than silently
213
+ * resurrect a store that promised it would never serve another op.
214
+ */
215
+ markSpawnedLive() {
216
+ if (this.lifecycle === 'live')
217
+ return;
218
+ if (this.lifecycle !== 'initializing' && this.lifecycle !== 'respawning') {
219
+ throw new Error(`oxigraph-worker: illegal spawn transition ${this.lifecycle} → live ` +
220
+ '(a worker may only be spawned from initializing or respawning; ' +
221
+ 'terminal states are permanent) — this is a bug in the respawn supervisor.');
222
+ }
223
+ this.lifecycle = 'live';
224
+ }
225
+ /** True once an operator-initiated close() has begun (closing or closed). */
226
+ get isClosing() {
227
+ return this.lifecycle === 'closing' || this.lifecycle === 'closed';
228
+ }
229
+ /**
230
+ * Create the worker thread and arm its lifecycle handlers. Shared by the
231
+ * constructor and by respawn() so a replacement worker is wired IDENTICALLY
232
+ * to the original — same impl path, same workerData, same handlers — and the
233
+ * OxigraphWorkerStore object keeps its identity, so every alias held across
234
+ * the daemon (routes, publisher, gossip ingest) transparently talks to the
235
+ * new thread. Each handler captures the worker it was armed for and no-ops
236
+ * if `this.worker` has since moved on, so a stale event from an
237
+ * already-replaced thread can never clobber the live one's state.
238
+ */
239
+ spawnWorker() {
240
+ const worker = new Worker(this.workerPath, {
241
+ workerData: { persistPath: this.persistPath },
106
242
  });
107
- this.worker.on('message', (msg) => {
243
+ this.worker = worker;
244
+ this.workerExited = false;
245
+ // Arming a fresh thread IS the transition into 'live'. Route it through the
246
+ // guarded `markSpawnedLive` (not `setLifecycle`, which forbids ALL entries
247
+ // to 'live'): it permits the two legal predecessors — the 'initializing'
248
+ // placeholder (constructor's first spawn) and 'respawning' (a respawn) —
249
+ // while still throwing on terminal states, so a stray spawn after close /
250
+ // give-up / in-memory-loss can never silently resurrect the store. close()
251
+ // and the respawn supervisor are the only other writers and never race
252
+ // this: a spawn only happens in the constructor or within respawn(), which
253
+ // bails the moment a close() is seen.
254
+ this.markSpawnedLive();
255
+ worker.on('message', (msg) => {
256
+ if (this.worker !== worker)
257
+ return;
258
+ // Any successful reply proves this worker is healthy, which ends the
259
+ // crash-loop accounting window (see MAX_CONSECUTIVE_RESPAWNS).
260
+ if (!msg.error)
261
+ this.consecutiveRespawnFailures = 0;
108
262
  const p = this.pending.get(msg.id);
109
263
  if (!p)
110
264
  return;
@@ -114,7 +268,14 @@ export class OxigraphWorkerStore {
114
268
  else
115
269
  p.resolve(msg.result);
116
270
  });
117
- this.worker.on('error', (err) => {
271
+ worker.on('error', (err) => {
272
+ if (this.worker !== worker)
273
+ return;
274
+ // Loud by design. 'error' means the worker thread threw an uncaught
275
+ // exception (an 'exit' event follows). This used to be silent, which is
276
+ // how a testnet node served HTTP for DAYS with a dead store — green
277
+ // /api/status, 503 on every write — and nothing in the logs said why.
278
+ console.error('[oxigraph-worker] worker thread error (thread is going down):', err);
118
279
  for (const [, p] of this.pending)
119
280
  p.reject(err);
120
281
  this.pending.clear();
@@ -123,16 +284,129 @@ export class OxigraphWorkerStore {
123
284
  // (reject) instead of leaving callers hung forever — this is what makes the
124
285
  // unbounded `close()` safe: if a second close (or any op) is still queued
125
286
  // when terminate() kills the thread, it rejects here rather than hanging.
126
- this.worker.on('exit', () => {
287
+ //
288
+ // Three very different exits land here (branch on lifecycle + persistPath):
289
+ // • intentional — close() ran (state is 'closing'). Stay closed; close()
290
+ // owns the final transition to 'closed'.
291
+ // • unexpected, disk-persisted — the thread died on its own.
292
+ // ERR_WORKER_OUT_OF_MEMORY, for example, kills ONLY the worker thread,
293
+ // not the process, so the daemon would otherwise keep serving with a
294
+ // permanently dead store. The committed state is on disk, so a fresh
295
+ // worker on the same path reopens it — go 'respawning' and recover.
296
+ // • unexpected, IN-MEMORY — there is no disk to reload from, so a fresh
297
+ // worker would come up EMPTY and look perfectly healthy while every
298
+ // row written before the crash is silently gone (confirmed live: data
299
+ // vanished). That is unrecoverable, so we FAIL CLOSED into the terminal
300
+ // 'in_memory_lost' state instead of respawning an empty store — every
301
+ // later op then rejects with a clear data-loss error (see postToWorker)
302
+ // rather than returning wrong-but-plausible results.
303
+ worker.on('exit', (code) => {
304
+ if (this.worker !== worker)
305
+ return;
127
306
  this.workerExited = true;
307
+ const intentional = this.isClosing;
308
+ // Distinguish the two unexpected exits up front so the log and the
309
+ // lifecycle transition below agree on what just happened.
310
+ const inMemoryLost = !intentional && this.persistPath === undefined;
311
+ if (intentional) {
312
+ console.info(`[oxigraph-worker] worker exited (code ${code}) — initiated by close()`);
313
+ }
314
+ else if (inMemoryLost) {
315
+ console.error(`[oxigraph-worker] worker exited UNEXPECTEDLY (code ${code}) — nobody called close(). ` +
316
+ 'FATAL: this store is IN-MEMORY (no persistPath), so its entire contents were lost with the ' +
317
+ 'worker thread and CANNOT be recovered. Failing the store closed instead of silently continuing ' +
318
+ 'with an empty store — every store-backed request will now fail fast. Use a disk-persisted store ' +
319
+ '(store.path) if the workload must survive a worker crash.');
320
+ }
321
+ else {
322
+ console.error(`[oxigraph-worker] worker exited UNEXPECTEDLY (code ${code}) — nobody called close(). ` +
323
+ 'The store is disk-persisted; respawning a fresh worker on the same path.');
324
+ }
128
325
  if (this.pending.size > 0) {
129
- const err = new Error('oxigraph-worker: worker exited before the operation completed (store closed)');
326
+ const err = intentional
327
+ ? new Error('oxigraph-worker: worker exited before the operation completed (store closed)')
328
+ : inMemoryLost
329
+ ? new Error(`oxigraph-worker: the IN-MEMORY worker exited unexpectedly (code ${code}) before the operation ` +
330
+ 'completed and its data was lost — an in-memory store cannot be recovered from a worker crash.')
331
+ : new Error(`oxigraph-worker restarted — retry: the worker exited unexpectedly (code ${code}) before the ` +
332
+ 'operation completed, so its outcome is unknown; a replacement worker is being spawned.');
130
333
  for (const [, p] of this.pending)
131
334
  p.reject(err);
132
335
  this.pending.clear();
133
336
  }
337
+ // Route the state transition. close() already moved us to 'closing' and
338
+ // owns the final hop to 'closed', so the intentional case touches nothing.
339
+ if (inMemoryLost) {
340
+ this.setLifecycle('in_memory_lost');
341
+ }
342
+ else if (!intentional) {
343
+ this.scheduleRespawn();
344
+ }
345
+ });
346
+ }
347
+ /** Arm (at most one) background respawn; the policy lives in respawn(). */
348
+ scheduleRespawn() {
349
+ // Never resurrect a store that has already given up, been closed, or lost
350
+ // its in-memory data, and never stack a second supervisor on an in-flight
351
+ // one. This is only ever reached from the exit handler's disk-persisted
352
+ // unexpected-exit branch, so we're normally transitioning out of 'live'.
353
+ if (this.respawnPromise || TERMINAL.has(this.lifecycle))
354
+ return;
355
+ this.setLifecycle('respawning');
356
+ // respawn() never rejects (every failure path is caught and looped or
357
+ // latched), so this promise can't become an unhandled rejection while no
358
+ // op happens to be parked on it.
359
+ this.respawnPromise = this.respawn().finally(() => {
360
+ this.respawnPromise = null;
134
361
  });
135
362
  }
363
+ /**
364
+ * Replace a crashed worker with a fresh one: immediate first attempt, then
365
+ * capped backoff (RESPAWN_BACKOFF_MS) between consecutive attempts, giving
366
+ * up for good after MAX_CONSECUTIVE_RESPAWNS workers in a row die without
367
+ * serving a single successful op. Giving up latches the store closed —
368
+ * exactly the pre-recovery behaviour — but with a FATAL log telling the
369
+ * operator what happened and where to look, instead of the old silence.
370
+ */
371
+ async respawn() {
372
+ while (true) {
373
+ // close() raced the respawn — honour it. An operator-initiated close
374
+ // must never be resurrected by the supervisor. (close() flips lifecycle
375
+ // to 'closing' atomically before awaiting, so isClosing is the signal.)
376
+ if (this.isClosing)
377
+ return;
378
+ if (this.consecutiveRespawnFailures >= MAX_CONSECUTIVE_RESPAWNS) {
379
+ this.setLifecycle('gave_up');
380
+ console.error(`[oxigraph-worker] FATAL: the worker died ${MAX_CONSECUTIVE_RESPAWNS} times in a row without ` +
381
+ 'serving a single successful operation — giving up on respawn and latching the store closed. ' +
382
+ 'Every store-backed request will now fail fast. Investigate the crash cause (worker OOM → raise ' +
383
+ 'memory or move to an external SPARQL backend via store.backend "sparql-http" / "blazegraph"; ' +
384
+ 'corrupt persist file → see the quarantine log) and restart the node.');
385
+ return;
386
+ }
387
+ const attempt = this.consecutiveRespawnFailures;
388
+ this.consecutiveRespawnFailures += 1;
389
+ const delayMs = RESPAWN_BACKOFF_MS[Math.min(attempt, RESPAWN_BACKOFF_MS.length - 1)];
390
+ if (delayMs > 0) {
391
+ console.error(`[oxigraph-worker] respawn attempt ${attempt + 1}/${MAX_CONSECUTIVE_RESPAWNS} in ${delayMs}ms…`);
392
+ await sleep(delayMs);
393
+ // Re-check: close() may have arrived during the backoff sleep.
394
+ if (this.isClosing)
395
+ return;
396
+ }
397
+ try {
398
+ this.spawnWorker();
399
+ console.info(`[oxigraph-worker] respawned worker (attempt ${attempt + 1}/${MAX_CONSECUTIVE_RESPAWNS})`);
400
+ return;
401
+ }
402
+ catch (err) {
403
+ // new Worker() itself can throw (e.g. the impl file vanished at
404
+ // runtime). Treat it exactly like a worker that died instantly and
405
+ // loop into the next backoff tier.
406
+ console.error('[oxigraph-worker] respawn attempt failed to start a worker:', err);
407
+ }
408
+ }
409
+ }
136
410
  call(method, ...args) {
137
411
  // Only read-only ops are bounded; mutations run unbounded (timeoutMs 0) so a
138
412
  // timed-out write is never reported as a clean failure while still in flight.
@@ -140,21 +414,62 @@ export class OxigraphWorkerStore {
140
414
  return this.callWithTimeout(timeoutMs, undefined, method, ...args);
141
415
  }
142
416
  /**
143
- * Post one op to the worker and await its reply, bounding the caller's wait by
144
- * `timeoutMs` (0 = wait indefinitely). The bound is per-CALLER: on timeout or
145
- * caller abort we reject and drop the pending entry, but the single-threaded worker is STILL
146
- * running the op — the late reply is then ignored (the message handler no-ops
147
- * on a missing id) rather than double-settling this promise. Only read-only
148
- * ops are ever given a non-zero timeout (see `call`), so a fired timeout is
149
- * always a determinate, side-effect-free failure.
417
+ * Post one op to the (live) worker and await its reply, bounding the caller's
418
+ * wait by `timeoutMs` (0 = wait indefinitely). The bound is per-CALLER: on
419
+ * timeout or caller abort we reject and drop the pending entry, but the
420
+ * single-threaded worker is STILL running the op — the late reply is then
421
+ * ignored (the message handler no-ops on a missing id) rather than
422
+ * double-settling this promise. Only read-only ops are ever given a non-zero
423
+ * timeout (see `call`), so a fired timeout is always a determinate,
424
+ * side-effect-free failure. If a crashed worker is being replaced, the op
425
+ * first parks on the respawn (the timeout starts only once it is actually
426
+ * posted — backoff is capped well below the default read bound anyway).
150
427
  */
151
428
  callWithTimeout(timeoutMs, signal, method, ...args) {
429
+ // A crashed worker may be mid-replacement right now. Park the op on the
430
+ // respawn instead of failing it: the store is disk-persisted and about to
431
+ // come back, so the caller sees a slightly slower success rather than a
432
+ // spurious "store is closed" for a condition the store is already fixing.
433
+ if (this.respawnPromise)
434
+ return this.callAfterRespawn(timeoutMs, signal, method, args);
435
+ return this.postToWorker(timeoutMs, signal, method, args);
436
+ }
437
+ /**
438
+ * Wait out the in-flight respawn(s), then post as normal. A loop rather
439
+ * than a single await because the replacement worker can itself die before
440
+ * this op gets posted, arming a new respawnPromise. If the respawn gave up,
441
+ * postToWorker's workerExited guard turns this into the fail-fast closed
442
+ * error (with the crash-loop guidance appended).
443
+ */
444
+ async callAfterRespawn(timeoutMs, signal, method, args) {
445
+ while (this.respawnPromise)
446
+ await this.respawnPromise;
447
+ return this.postToWorker(timeoutMs, signal, method, args);
448
+ }
449
+ postToWorker(timeoutMs, signal, method, args) {
152
450
  const id = this.nextId++;
153
451
  return new Promise((resolve, reject) => {
154
- // The worker is gone a posted message would never be answered, so fail
155
- // fast instead of registering a pending entry that can only ever hang.
452
+ // The worker is gone (closed, crashed with respawn given up, or an
453
+ // in-memory store whose data was lost) a posted message would never be
454
+ // answered, so fail fast instead of registering a pending entry that can
455
+ // only ever hang. The lifecycle picks the RIGHT diagnostic:
456
+ // • in_memory_lost — the data is unrecoverable; say so plainly instead
457
+ // of pretending the store merely "closed" (finding 1: never let an
458
+ // in-memory crash look like a clean close or an empty-but-healthy store).
459
+ // • gave_up — closed + the crash-loop guidance.
460
+ // • otherwise — a plain operator close.
156
461
  if (this.workerExited) {
157
- reject(new Error(`oxigraph-worker: cannot run "${method}" — the store is closed.`));
462
+ if (this.lifecycle === 'in_memory_lost') {
463
+ reject(new Error(`oxigraph-worker: cannot run "${method}" — the IN-MEMORY store's worker crashed and its data was ` +
464
+ 'lost. An in-memory store cannot be recovered from a worker crash; every request now fails ' +
465
+ 'fast. Use a disk-persisted store (store.path) or restart the node to start from empty.'));
466
+ return;
467
+ }
468
+ reject(new Error(`oxigraph-worker: cannot run "${method}" — the store is closed.` +
469
+ (this.lifecycle === 'gave_up'
470
+ ? ' (The worker crashed repeatedly and automatic respawn gave up — restart the node and ' +
471
+ 'investigate the [oxigraph-worker] crash logs.)'
472
+ : '')));
158
473
  return;
159
474
  }
160
475
  if (signal?.aborted) {
@@ -245,18 +560,34 @@ export class OxigraphWorkerStore {
245
560
  // we issue exactly one close RPC. (A second unbounded close RPC would be
246
561
  // orphaned when terminate() kills the worker after the first resolves, and
247
562
  // — without the exit handler — would hang forever.)
248
- if (!this.closePromise)
563
+ //
564
+ // Flip the lifecycle to 'closing' FIRST (before awaiting anything), unless
565
+ // the store already reached a terminal state on its own (gave_up /
566
+ // in_memory_lost, or an even earlier close). Doing it synchronously here is
567
+ // what lets an in-flight respawn see the close and bail (respawn() checks
568
+ // isClosing) and what makes the worker's 'exit' handler treat this exit as
569
+ // intentional. A store that already latched terminal is simply reaped below
570
+ // — its state is permanent, so we must NOT try to move it to 'closing'.
571
+ if (!this.closePromise) {
572
+ if (!TERMINAL.has(this.lifecycle))
573
+ this.setLifecycle('closing');
249
574
  this.closePromise = this.doClose();
575
+ }
250
576
  return this.closePromise;
251
577
  }
252
578
  async doClose() {
253
- // Worker already gone (crash/kill) there's nothing to flush; just make
254
- // sure the thread is reaped. Keeps close() idempotent and non-throwing.
579
+ // Worker already gone (crash/kill, respawn give-up, or in-memory loss)
580
+ // there's nothing to flush; just make sure the thread is reaped. Keeps
581
+ // close() idempotent and non-throwing. Only settle into the terminal
582
+ // 'closed' state when we're not already in a *different* terminal state
583
+ // (gave_up / in_memory_lost stay as-is so their diagnostics survive).
255
584
  if (this.workerExited) {
256
585
  try {
257
586
  await this.worker.terminate();
258
587
  }
259
588
  catch { /* already terminated */ }
589
+ if (!TERMINAL.has(this.lifecycle))
590
+ this.setLifecycle('closed');
260
591
  return;
261
592
  }
262
593
  // `close` runs the worker's FINAL synchronous flush (insert() only schedules
@@ -271,6 +602,11 @@ export class OxigraphWorkerStore {
271
602
  }
272
603
  finally {
273
604
  await this.worker.terminate();
605
+ // The 'exit' handler above left us in 'closing' (intentional exit). Land
606
+ // the terminal transition here so a post-close op fails fast (workerExited
607
+ // is now set, and the guard reads 'closed' for the plain message).
608
+ if (!TERMINAL.has(this.lifecycle))
609
+ this.setLifecycle('closed');
274
610
  }
275
611
  }
276
612
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oxigraph-worker.js","sourceRoot":"","sources":["../../src/adapters/oxigraph-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAY7C;;;;GAIG;AACH,SAAS,uBAAuB,CAAC,KAAyB,EAAE,QAAgB;IAC1E,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;QACtE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QACnB,CAAC,CAAC,QAAQ,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,MAAe;IACnC,OAAO,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MA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,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC9B,yEAAyE;YACzE,2EAA2E;YAC3E,mEAAmE;YACnE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;gBAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF;AAED,0BAA0B,CAAC,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAC3D,MAAM,QAAQ,GAAG,IAAI,EAAE,IAA0B,CAAC;IAClD,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE;QACvC,kBAAkB,EAChB,OAAO,IAAI,EAAE,kBAAkB,KAAK,QAAQ,CAAC,CAAC,CAAE,IAAI,CAAC,kBAA6B,CAAC,CAAC,CAAC,SAAS;KACjG,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@origintrail-official/dkg-storage",
3
- "version": "10.0.2",
3
+ "version": "10.0.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "dependencies": {
8
8
  "oxigraph": "^0.5",
9
- "@origintrail-official/dkg-core": "10.0.2"
9
+ "@origintrail-official/dkg-core": "10.0.3"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@vitest/coverage-v8": "^4.0.18",