prototype-server-vision: concurrency script: no SLOW lines must not fail the run (grep rc under set -e)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 16:29:52 +01:00
co-authored by Claude Sonnet 5.5
parent 1670e104a2
commit 18c98844ad
23 changed files with 25 additions and 25 deletions
+1 -1
View File
@@ -45,7 +45,7 @@
"tools/leaktest.sh"
],
"concurrency": [
"mkdir -p results; D=${DUR:-60}; N=${TAG:-${D}s}; tools/withserver.sh node tools/concurrency.mjs > results/concurrency-$N.log 2>&1; rc=$?; cat results/concurrency-$N.log; grep STATS run/test/server.log | awk '{k=$0; sub(/ n=.*/, \"\", k); a[k]=$0} END{for (k in a) print a[k]}' | sort > results/concurrency-$N-server.log; grep SLOW run/test/server.log >> results/concurrency-$N-server.log; exit $rc"
"mkdir -p results; D=${DUR:-60}; N=${TAG:-${D}s}; tools/withserver.sh node tools/concurrency.mjs > results/concurrency-$N.log 2>&1; rc=$?; cat results/concurrency-$N.log; grep STATS run/test/server.log | awk '{k=$0; sub(/ n=.*/, \"\", k); a[k]=$0} END{for (k in a) print a[k]}' | sort > results/concurrency-$N-server.log; { grep SLOW run/test/server.log >> results/concurrency-$N-server.log || true; }; exit $rc"
],
"faulttest": [
"tools/faulttest.sh"
+4 -4
View File
@@ -1,5 +1,5 @@
1 poly (jittered start positions): n=2000 avg=0.038ms worst=0.188ms
6 polys (one 6-token party): n=500 avg=0.207ms worst=0.287ms
1 poly + cellsTouched: n=2000 avg=0.456ms worst=1.222ms
6 polys + cellsTouched: n=300 avg=3.049ms worst=5.144ms
1 poly (jittered start positions): n=2000 avg=0.036ms worst=0.069ms
6 polys (one 6-token party): n=500 avg=0.202ms worst=0.266ms
1 poly + cellsTouched: n=2000 avg=0.448ms worst=0.913ms
6 polys + cellsTouched: n=300 avg=2.943ms worst=3.651ms
(sink 2063860)
@@ -11,9 +11,9 @@
[OK] shared endpoint: no leak at the vertex
[OK] '<' apex: ray through the shared tip must not leak
[OK] every segment endpoint is a polygon vertex (lower and upper end inclusive)
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(65, 14): Check failed: sees(w, (0.0, 7.4), (100.0, -6.0))
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(69, 14): Check failed: sees(m, (0.0, -7.4), (100.0, 6.0))
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(73, 14): Check failed: sees(b, (0.0, -24.0), (200.0, 130.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(65, 14): Check failed: sees(w, (0.0, 7.4), (100.0, -6.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(69, 14): Check failed: sees(m, (0.0, -7.4), (100.0, 6.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(73, 14): Check failed: sees(b, (0.0, -24.0), (200.0, 130.0))
[FAILED] rays nudged past a corner: area just beyond a wall end is visible
[OK] shared endpoint: closed corner of box has no crack
[OK] collinear walls act as one
@@ -50,7 +50,7 @@
[OK] near closed door blocks, open door passes
[OK] 64px corridor and doorway passable on centerline
[OK] legacy overlap can escape, not stay overlapped
Error: execution of an external program failed: '/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry'
Error: execution of an external program failed: '/tmp/tmp.NVulDEmX9F/w/tests/tgeometry'
# test exit=1
# NEW tests failed:
@@ -10,14 +10,14 @@
[OK] open space is a circle
[OK] wall blocks
[OK] shared endpoint: no leak at the vertex
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(45, 59): Check failed: visibilityPolygon((0.0, 0.0), w, 500).hasVertex((100.0, 0.0))
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(46, 12): Check failed: not sees(w, (0.0, 0.0), (150.0, 0.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(45, 59): Check failed: visibilityPolygon((0.0, 0.0), w, 500).hasVertex((100.0, 0.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(46, 12): Check failed: not sees(w, (0.0, 0.0), (150.0, 0.0))
sees(w, (0.0, 0.0), (150.0, 0.0)) was true
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(47, 12): Check failed: not sees(w, (0.0, 0.0), (300.0, 0.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(47, 12): Check failed: not sees(w, (0.0, 0.0), (300.0, 0.0))
sees(w, (0.0, 0.0), (300.0, 0.0)) was true
[FAILED] '<' apex: ray through the shared tip must not leak
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(55, 24): Check failed: poly.hasVertex((80.0, 10.0))
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(58, 22): Check failed: pr.hasVertex((50.0, -30.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(55, 24): Check failed: poly.hasVertex((80.0, 10.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(58, 22): Check failed: pr.hasVertex((50.0, -30.0))
[FAILED] every segment endpoint is a polygon vertex (lower and upper end inclusive)
[OK] rays nudged past a corner: area just beyond a wall end is visible
[OK] shared endpoint: closed corner of box has no crack
@@ -55,7 +55,7 @@
[OK] near closed door blocks, open door passes
[OK] 64px corridor and doorway passable on centerline
[OK] legacy overlap can escape, not stay overlapped
Error: execution of an external program failed: '/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry'
Error: execution of an external program failed: '/tmp/tmp.NVulDEmX9F/w/tests/tgeometry'
# test exit=1
# NEW tests failed:
@@ -10,14 +10,14 @@
[OK] open space is a circle
[OK] wall blocks
[OK] shared endpoint: no leak at the vertex
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(45, 59): Check failed: visibilityPolygon((0.0, 0.0), w, 500).hasVertex((100.0, 0.0))
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(46, 12): Check failed: not sees(w, (0.0, 0.0), (150.0, 0.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(45, 59): Check failed: visibilityPolygon((0.0, 0.0), w, 500).hasVertex((100.0, 0.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(46, 12): Check failed: not sees(w, (0.0, 0.0), (150.0, 0.0))
sees(w, (0.0, 0.0), (150.0, 0.0)) was true
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(47, 12): Check failed: not sees(w, (0.0, 0.0), (300.0, 0.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(47, 12): Check failed: not sees(w, (0.0, 0.0), (300.0, 0.0))
sees(w, (0.0, 0.0), (300.0, 0.0)) was true
[FAILED] '<' apex: ray through the shared tip must not leak
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(54, 24): Check failed: poly.hasVertex((50.0, -30.0))
/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry.nim(59, 22): Check failed: pr.hasVertex((80.0, 10.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(54, 24): Check failed: poly.hasVertex((50.0, -30.0))
/tmp/tmp.NVulDEmX9F/w/tests/tgeometry.nim(59, 22): Check failed: pr.hasVertex((80.0, 10.0))
[FAILED] every segment endpoint is a polygon vertex (lower and upper end inclusive)
[OK] rays nudged past a corner: area just beyond a wall end is visible
[OK] shared endpoint: closed corner of box has no crack
@@ -55,7 +55,7 @@
[OK] near closed door blocks, open door passes
[OK] 64px corridor and doorway passable on centerline
[OK] legacy overlap can escape, not stay overlapped
Error: execution of an external program failed: '/tmp/tmp.hrEZipnqQ0/w/tests/tgeometry'
Error: execution of an external program failed: '/tmp/tmp.NVulDEmX9F/w/tests/tgeometry'
# test exit=1
# NEW tests failed:
@@ -1,8 +1,8 @@
# 583 ms spike investigation (results/concurrency-60s.log: worst intent->ack 583.13 ms, avg 6.33 ms)
# 583 ms spike investigation (results/spike/original-60s.log: worst intent->ack 583.13 ms, avg 6.33 ms)
Setup: DUR=60, isolated stack (run/test, :18088/:19000), CPU powersave governor untouched, runs strictly sequential.
Server now logs per mutation: lock_wait / vision / sqlite / send / total, `SLOW` line when total > `SLOW_MS` (default 50), percentiles in `STATS timing_ms` (end of run + every 5000 mutations).
Client p99 added to `tools/concurrency.mjs`. Logs: `results/concurrency-run{1,2,3}[-server].log` (baseline), `results/concurrency-fixed-run{1,2,3}[-server].log` (after fix).
Client p99 added to `tools/concurrency.mjs`. Logs: `results/spike/base{1,2,3}[-server].log` (baseline), `results/spike/fixed{1,2,3}[-server].log` (after fix).
## Runs (client intent->ack, ms | server total per mutation, ms)
| run | avg | p99 | worst | srv avg | srv p99 | srv worst | srv sqlite avg / worst | srv lock_wait worst |
@@ -17,7 +17,7 @@ Client p99 added to `tools/concurrency.mjs`. Logs: `results/concurrency-run{1,2,
(base runs' sqlite worst: run 2 file shows 21.2, run 3 file 9.6; table taken per file.)
## Slowest mutations (baseline; only one exceeded 50 ms in 3 runs, `SLOW` lines in `*-server.log`)
## Slowest mutations (baseline; only one exceeded 50 ms in 3 runs, `SLOW` lines in `spike/*-server.log`)
- run1 gseq=136 move-player total=63.8: sqlite=62.9 (COMMIT), vision 0.7, send 0.1, lock_wait 0.
- run1 gseq=138 move-monster total=56.6: lock_wait=55.9 (queued behind gseq=136's commit).
- run1 gseq=152 move-player total=72.9: lock_wait=71.7 (queued behind another stalled holder), rest < 1.
@@ -29,4 +29,4 @@ Vision (worst 4-5 ms) and send enqueue (worst < 0.6 ms) never matter. The global
- What the breakdown does show: server-side tail (>10 ms) is the SQLite COMMIT (fsync, synchronous=FULL in WAL) + lock queueing behind it. Compute (vision) and send are not the tail.
- Fix: `PRAGMA synchronous=NORMAL` (WAL), 1 line in `src/server.nim`. Effect (before -> after, mean of 3 runs): sqlite avg 0.60 -> 0.17 ms, p50 0.60 -> 0.14 ms, server total avg 1.16 -> 0.74 ms, client avg 1.82 -> 1.46 ms. Tail is NOT fixed: server worst stays ~20 ms (sqlite worst ~18 ms still, now likely WAL auto-checkpoint / OS scheduling rather than per-commit fsync), client p99 ~4.6-5.1 ms unchanged within noise. The 73 ms outlier of base run 1 did not recur in fixed runs, but n=3, not evidence.
- Tradeoff: with synchronous=NORMAL in WAL, a commit is not fsynced; process crash/SIGKILL loses nothing (restart test passes), OS crash / power loss may drop the last few committed mutations (never corrupts). Ack-before-durable on power loss. Not done: moving persist out of the lock (would break gseq order == send order / ack-after-commit).
- After the change leaktest, faulttest, restart re-run: all PASS (`results/postfix-{leaktest,faulttest,restart}.log`; leak-A/B logs byte-identical to committed).
- After the change leaktest, faulttest, restart re-run: all PASS (`results/spike/postfix-{leaktest,faulttest,restart}.log`; leak-A/B logs byte-identical to committed).