mirror of
https://github.com/screentinker/screentinker.git
synced 2026-06-29 09:23:16 -06:00
A FK constraint violation crashed the whole process on 1.9.1-beta2 with a bare "FOREIGN KEY constraint failed" and NO stack — so it couldn't be root- caused. better-sqlite3 is synchronous, so such a throw inside a socket.io handler (no local try/catch) propagates to uncaughtException, and with no handler Node exits traceless. Add a small top-of-server.js net that logs the FULL err.stack (file:line of the offending write) + timestamp, best-effort closes the DB (WAL flush), then exits(1) so systemd restarts fresh. NOT catch-and-continue — after an uncaught throw the process state is undefined, so we never keep serving. This is the investigation tool the root-cause fix is blocked on, plus the fleet-wide-crash net #114 asked for. Verified (not assumed): - A synthetic synchronous FK throw inside a real socket.io handler IS caught by uncaughtException, logs the full stack incl. the throwing file:line, exits 1. - Non-over-reach: a FK throw in an Express route -> Express handles it (500), a throw in a local try/catch -> caught (200); the global net does NOT fire and the process stays alive. Last resort, not a catch-all. - 149 server tests green; server boots clean (net doesn't trip on startup). The root-cause FK fix is SEPARATE and waits on the stack trace this produces. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| config | ||
| db | ||
| lib | ||
| middleware | ||
| player | ||
| routes | ||
| scripts | ||
| services | ||
| test | ||
| ws | ||
| .gitignore | ||
| config.js | ||
| package-lock.json | ||
| package.json | ||
| server.js | ||
| version.js | ||