jnqtech studio emblem
jnqtech

The 6-Hour Crash Test That Failed on Interval #4,277 — And the 10% Slow Linux Clock

Why I threw away single-player sync for a clean-room Rust MMO server, survived eight hard Docker kills over six hours, failed by 149 ms on checkpoint #4,277 — and discovered via an AI audit that WSL2's kernel clock had been running 10% slow the whole time.

The Pall2026-12-02·7 min read·Rust · Netcode · PostgreSQL · Debugging
The 6-Hour Crash Test That Failed on Interval #4,277 — And the 10% Slow Linux Clock
In This 7-Part Series: Building The Pall▾
  1. 01I Never Meant to Build an MMORPG: How an AI-Org Experiment Escalated Into The Pall6m
  2. 02One Prompt, 18 AI Employees, 76 Ticks — And Why the Charging Wolf Looked Like a Tree5m
  3. 03I Banned Three.js, Built Custom WebGPU, Tested Unreal and Unity, Then Came Back to Three.js6m
  4. 04The 6-Hour Crash Test That Failed on Interval #4,277 — And the 10% Slow Linux ClockREADING
  5. 05583 Tracker Commits, Zero Features, and 192 GiB of Evidence: Cutting 85% of My Own AI Bureaucracy13m
  6. 06My Validator Rejected 21,500 Lines of AI Terrain (6,096 Floating Road Vertices) — Building the Valley in Code & Headless Blender6m
  7. 07From 5 Struggling Bots to 1,500+ MMORPG Players on One €10.49 ARM VPS15m

The August prototype (td-v1) had one dirty secret: it wasn't really a multiplayer game. The browser ran the simulation locally and batched /session/sync updates back to the API, reporting its own coordinates. That was fine for an early single-player prototype, but nowhere near the server-authoritative persistence I wanted for an online RPG.

On August 23, I drew a hard line and had the agents start a clean-room multiplayer engine rewrite (td-v2-edge) built around one stubborn invariant:

One logical realm per native Rust process. One mutable owner per live entity. Intent goes in; outcomes come out. A reward is durable in PostgreSQL before the player ever sees it.

20 Hz
Authoritative Sim Tick
Single mutable owner thread in Rust
491 KB
Browser Client WASM
Zero imports · bit-exact across 4 runtimes
5,399 ms
Checkpoint #4,277
1 miss out of 4,277 after 6 straight hours
65,529 HP
Release-Mode u16 Wrap
Caught by hostile audit when tests were green

Designing a Boring, Bulletproof Rust Realm Server

I didn't know how commercial MMO backends were stitched together internally, so I aimed for an architecture that pushed as many invariants into types and database permissions as I knew how to express:

  • One simulation owner thread: Runs at a fixed 20 Hz (50 ms) tick, owns the mutable world state, resolves movement, combat, loot, quests, and AI, and publishes an immutable Arc<ReplicationSnapshot> to network writers. It never holds a database handle.
  • Epoch-fenced PostgreSQL persistence: To keep "durable before display" from stalling the 50 ms sim tick, combat kills and rewards hand off asynchronously to background persistence lanes that settle through PostgreSQL stored routines stamped with a monotonic realm epoch (with idempotent retries if a DB reply drops). The world server's DB role has zero direct write access to fenced tables — if an old process ever wakes up after a crash, the database rejects its stale epoch automatically.
  • Strict browser WASM isolation: Shared deterministic rules (pallwright-rules) use integer millimeter coordinates, fixed-point Q30 yaw angles, and software math (libm), with Clippy banning 25 non-deterministic float operations across the workspace. A CI check inspects cargo tree to prove server authority and RNG crates are structurally unreachable from the 491 KB zero-import browser WASM — verified byte-identical across native Rust builds, Node, and Wasmtime.
  • Simple, cheat-resistant netcode: Forward-only client prediction, compact binary postcard wire frames, and one-shot spatial visibility queries so the server stays lean and predictable under load.
Left: the single-owner Rust realm architecture and epoch-fenced database boundary. Right: how checkpoint #4,277 and a 10% slow WSL2 kernel clock exposed the real crash-recovery margin.
Left: the single-owner Rust realm architecture and epoch-fenced database boundary. Right: how checkpoint #4,277 and a 10% slow WSL2 kernel clock exposed the real crash-recovery margin.

The 6-Hour Crash Soak That Failed on Interval #4,277

Because the core rule was "a reward is durable before it is shown," I had the AI build a brutal 6-hour continuous crash-recovery soak. The realm had to survive eight hard Docker SIGKILL crashes over six hours with zero lost settled outcomes and a recovery-point objective (RPO) under 5.6 seconds.

September 1 was a humbling day:

  • Run 1 survived the first three kills, then wedged Docker completely and forced a full host reboot.
  • Run 2 ran cleanly through all six hours (21,660,000 milliseconds) and all eight crash-and-recovery cycles — and then exited with failure right at the finish line. Why? Out of 4,277 checkpoint intervals, 4,276 landed inside the strict 5,000 ± 250 ms cadence rule, and one single interval took 5,398.98 ms — 149 milliseconds over the line.

The agents fixed the cadence jitter, I re-ran it on September 2, and by September 4 it looked like a clean green signoff.

The Hostile Audit Bombshell: Linux Was Lying About Time

Right before consolidating the engine into the main /the-pall repo, I set a fresh-context hostile AI auditor loose with one job: prove my green signoff was wrong. Within hours, it dropped two bombshells that humbled me completely.

First, it caught why the soak trace had quietly logged 766 forward time jumps totaling +1,248.7 seconds over six hours (and 79,278 "Clock change detected" events in two weeks). The earlier soak receipts had actually seen the discrepancy and blamed the civil clock while trusting CLOCK_MONOTONIC as ground truth. The fresh auditor ran adjtimex on my WSL2 machine (tick=9000 instead of 10000) plus a 60-second idle check where CLOCK_MONOTONIC advanced 60.013 s while CLOCK_MONOTONIC_RAW advanced 66.681 s (an exact 0.900 ratio). The Linux kernel clock had been running 3% to 11% slow across two boots, while systemd-timesyncd (syncing against ntp.ubuntu.com) kept stepping wall time forward ~3.3 seconds every ~33 seconds to catch up.

Because Rust's Instant, Tokio timers, Node's hrtime, and Chromium's performance.now all read CLOCK_MONOTONIC, my "20 Hz" server had actually been ticking at 18.46 Hz in physical time — turning a seemingly passing 5.455 s RPO into up to 5.831 s over the 5.6 s limit.

Second, the exact same hostile audit caught a nastier combat math bug hiding in single-threaded ticks: if Player 1 cast an area-of-effect Whirl that killed Mob 1 and injured Mob 2 nonlethally, the engine staged Mob 2's nonlethal damage plan using its pre-tick HP while putting only lethal Mob 1 into pending_deaths. If Player 2 hit Mob 2 in the exact same tick, Player 2's attack saw Mob 2 wasn't in pending_deaths and subtracted its damage immediately — and then the staged nonlethal plan ran hp -= plan.damage on a u16 with the stale amount. An exact sum left a zombie mob alive at 0 HP; an over-sum panicked in debug builds and underflow-wrapped to 65,529 HP in release builds! Every prior test had missed it because they used either one player or one shared mob.

I had the AI fix the saturating damage arithmetic (and added overflow checks to release profiles), moved the RPO measurement onto a disciplined-clock Hetzner Cloud VPS with physical wall-clock checks (worst physical loss across eight hard kills: 4.846 seconds, cleanly under 5.6 s), and merged the engine into /the-pall on September 6.

One Assertion Ate 55 GB of RAM (Hello, cgroup v2)

Eight days later, during gameplay parity testing on September 14, my workstation suddenly froze solid. WSL had chewed through 24 GB of physical RAM and all 32 GB of swap in seconds.

The culprit wasn't a memory leak in Rust — it was one strict assertion mismatch in a Node test that politely tried to pretty-print a diff across 1,015,856 table rows in memory.

That afternoon I put every local build and test harness inside a permanent Linux systemd cgroup v2 wrapper with zero swap, a hard memory ceiling, and OOMPolicy=kill so a runaway test kills its own process tree instantly instead of taking down the whole machine. Later, when the Rust test binaries grew so large that rustc itself tripped the cap, splitting integration targets and tuning codegen units kept builds fast inside the fence.

Two days later (September 16), after my old Git LFS proof archive had ballooned to 19.06 GB, I archived the legacy bundle safely to cloud storage and started /the-pall from a clean 333 MB root commit.

Meanwhile, On the Surface: The Honest Alpha UI

All of this deep backend engineering had one funny side effect: while the Rust server was surviving hard Docker kills and verifying deterministic WASM across four runtimes, the actual game UI through late September and early October still looked like a programmer's fever dream.

Three phases of early HUD chaos in one vertical strip (Sep 28): top — austere grey-box prototype combat buttons on an empty hill; middle — August Gold fantasy HUD; bottom — Violet v2.1 experiment with party frames.
Three phases of early HUD chaos in one vertical strip (Sep 28): top — austere grey-box prototype combat buttons on an empty hill; middle — August Gold fantasy HUD; bottom — Violet v2.1 experiment with party frames.

My favorite artifact from that era is still the October 2 Violet UX build, featuring open-gabled placeholder houses, a polka-dot road, and in-game chat calmly explaining the situation to itself:

October 2 Violet HUD alpha capture — placeholder gables, polka-dot road, and brutally honest test chat: "Chat is not working. This is a demo... It will be fixed."
October 2 Violet HUD alpha capture — placeholder gables, polka-dot road, and brutally honest test chat: "Chat is not working. This is a demo... It will be fixed."

With the Rust engine finally solid on a clean repository, I was right on schedule to hit the biggest self-inflicted wall of the entire project: letting my own process eat the game alive.

FEATURED GAME · OPEN ALPHA · FREE (LV 1–6)

The Pall

A phones-first dark-fantasy browser MMORPG built on a custom Rust realm server — play the Levels 1–6 South Start Valley free in Open Alpha with zero app store install and no invite code required.

View The Pall →
RELEASE & DEVLOG ALERTS

Follow Future Deep Dives & Game Launches

No spam — only real engineering writeups, alpha updates, and launches.

← All Devlogs