08363ef086deb2c3732eec8ba3359bb876924228
Mummy runs websocket handlers on worker threads. Intents are parsed outside the one global lock, while the world is walked under it; ORC refcounts are not atomic, so any JsonNode or string payload reachable from both an intent tree and the world can be freed or leaked by two threads at once. - Add server/jsonbound.nim: detachedJson/detachedString/detachedProps copies that share neither nodes nor string payloads (serialise+parse; std/json's copy() would still alias JString payloads). - Detach every intent value that enters world state: wall.add/wall.update flags; token.create flags/props/names/kind/character_id; token.update patch fields; prop.set key and value (token and character); character.create props/names; scene.set name/extra. Use the world's own id in name.reveal. - Build wall effects and create acks inside the mutation's critical section (settleLocked/settleWorldLocked). Wall/token/character record copies and frames no longer outlive the lock; only fresh scalars cross it. - Move player.remove's in-memory follow-up under the lock (it mutated tokens, characters, visions, reveals and encountered outside it). - Cap mummy at 4 worker threads (default was 10x cores) for a seven-person table. - Add tests/tdetach.nim: identity and string-payload checks for the boundary helpers, plus the parseFlags-returns-the-caller's-node premise. A unit test can prove the copy semantics, not the absence of a race.
Description
No description provided
9.2 MiB
Languages
JavaScript
38.4%
Nim
38.3%
TypeScript
20.9%
Shell
1.9%
CSS
0.5%