{"record":{"id":"7516a50c0517aec5","repo":"run-llama/liteparse","slug":"liteparse-worker-process-died-while-parsing-sour","errorCode":null,"errorMessage":"liteparse worker process died while parsing ${source}: ${e.message}","messagePattern":"liteparse worker process died while parsing (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/node/src/pool.ts","lineNumber":269,"sourceCode":"  async parse(payload: string | Buffer, source: string): Promise<ParseResult> {\n    if (this.closed) throw new Error(\"parser pool is closed\");\n    const worker = await this.acquire();\n    try {\n      await worker.ready();\n      const result = await worker.request(payload, this.timeoutMs);\n      this.release(worker);\n      return result;\n    } catch (e) {\n      this.retire(worker);\n      if (e instanceof WorkerTimeout) {\n        throw new ParseTimeoutError(\n          `parse of ${source} exceeded ${this.timeoutMs}ms; the worker process was killed`,\n          source,\n          this.timeoutMs!,\n        );\n      }\n      if (e instanceof WorkerCrashed) {\n        throw new Error(\n          `liteparse worker process died while parsing ${source}: ${e.message}`,\n        );\n      }\n      throw e;\n    }\n  }\n\n  /** Resolves when every worker is initialized. Optional — the first parse\n   * per worker waits for init anyway. */\n  async warmUp(): Promise<void> {\n    await Promise.all([...this.workers].map((w) => w.ready()));\n  }\n\n  /** Shut down all workers. Idempotent. Busy workers are stopped as their\n   * in-flight parses finish. */\n  close(): void {\n    if (this.closed) return;\n    this.closed = true;","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/run-llama/liteparse/blob/22d2dd8cd7f7b9320102b57ddaf0e663ff7d15a8/packages/node/src/pool.ts#L251-L287","documentation":"If the worker child process dies unexpectedly during a parse (crash, OOM kill, native segfault in PDFium), the pool wraps it in this error naming the source document and the underlying message. The dead worker is retired and replaced, so the pool can keep serving other parses. Unlike a timeout, this indicates an abnormal termination rather than an elapsed-time limit.","triggerScenarios":"Worker process OOM-killed by the OS on a very large PDF; segfault or panic in native code (PDFium) while parsing a malformed/corrupt document; the worker being killed externally (container memory limits, cgroup OOM).","commonSituations":"Memory-capped Docker containers parsing large scanned PDFs; corrupt or fuzzed PDF inputs crashing PDFium; system-wide memory pressure under concurrent heavy parses.","solutions":["Catch the error and retry the parse once with a fresh pool/worker to rule out a transient kill.","Reduce memory pressure: lower poolSize or parse documents sequentially.","Check dmesg/container logs for OOM kills and raise the memory limit.","Verify the input opens in another PDF viewer; isolate corrupt documents before parsing.","Upgrade LiteParse in case the crash is a fixed native bug; report the crashing document to the maintainers."],"exampleFix":"// before\nconst result = await pool.parse(buf, 'doc.pdf');\n// after\nlet result;\ntry {\n  result = await pool.parse(buf, 'doc.pdf');\n} catch (e) {\n  if (e.message.startsWith('liteparse worker process died')) {\n    result = await newPool.parse(buf, 'doc.pdf'); // retry once\n  } else throw e;\n}","handlingStrategy":"retry","validationCode":"import { statSync } from 'fs';\nconst mb = statSync(path).size / 1e6;\nif (mb > 500) console.warn(`${path} is very large (${mb}MB); risk of worker OOM — consider splitting`);","typeGuard":null,"tryCatchPattern":"try {\n  result = await pool.parse(buf, source);\n} catch (e) {\n  if (e.message.startsWith('liteparse worker process died')) {\n    result = await pool.parse(buf, source); // pool replaces retired worker; retry once\n  } else throw e;\n}","preventionTips":["Set container memory limits well above peak parse memory for large documents.","Reduce poolSize under memory pressure; each worker holds its own native parser.","Pre-validate PDFs (try opening with another tool) to catch corrupt inputs early.","Watch for OOM-kill events in dmesg/container logs and correlate with this error.","Keep LiteParse updated so native PDFium crash fixes are picked up."],"tags":["worker-pool","crash","process"],"backgroundTag":"process-crashed","analyzedSha":"22d2dd8cd7f7b9320102b57ddaf0e663ff7d15a8","analyzedAt":"2026-09-08T06:09:49.009Z","contentChangedAt":"2026-09-08T06:09:49.009Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}