← back to Model Arena
resilience: global unhandledRejection/uncaughtException handlers so a stray async failure under batch load doesn't kill the server mid-run
b25a81bf3e437274de3809fb262f5d3039ddd314 · 2026-07-23 06:54:44 -0700 · Steve Abrams
Files touched
Diff
commit b25a81bf3e437274de3809fb262f5d3039ddd314
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Jul 23 06:54:44 2026 -0700
resilience: global unhandledRejection/uncaughtException handlers so a stray async failure under batch load doesn't kill the server mid-run
---
server.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/server.js b/server.js
index dd7ba44..0783089 100644
--- a/server.js
+++ b/server.js
@@ -2,6 +2,13 @@
// model's single-file HTML artifact side-by-side, crown a winner, keep a
// real-world win-rate ledger. Zero-dep Node. $0 by default (local Ollama);
// metered models are opt-in per-run and cost-logged.
+// Survive stray async failures. Node 15+ TERMINATES the process on an unhandled
+// promise rejection — under a heavy batch (4 local Ollama calls + metered ones in
+// flight) one aborting fetch would otherwise kill the whole server mid-run, marking
+// every in-flight model "server restarted mid-run". Log and keep serving instead.
+process.on('unhandledRejection', (e) => console.error('[unhandledRejection]', (e && e.stack) || e));
+process.on('uncaughtException', (e) => console.error('[uncaughtException]', (e && e.stack) || e));
+
const http = require('http'), fs = require('fs'), path = require('path'), os = require('os');
const crypto = require('crypto');
const { execFile } = require('child_process');
← 1e4746a arena: move Build-in-iTerm from whole-challenge to per-MODEL
·
back to Model Arena
·
arena: harden with unhandledRejection/uncaughtException guar 41ff05b →