Record the machine’s load beside every timing, and give every test run its own ports, files and server.
This post is about running many build and test agents on one machine. On 16 Nov, up to 22 agents shared one 16-core Mac. Its 1-minute load stayed between 30 and 120 for hours and peaked at 206. Some failures came from the load. Others came from our own tools, which trusted results they had not checked. This applies to any CI box or developer machine that runs tests in parallel. The wiki page How we test describes the current state.
Every uptime reading in the agents’ logs for each hour (1,055 in all). One deploy can be several commits.
| Failure | Cause | Fix |
|---|
| A map check that should take a few seconds took 7.5 to 9.4 s. A solver given 60 s logged 184 s for one step. | At a load of 80, 16 cores give each process only a fraction of one core. | Heavy tests now wait until the load is under about 30. Timed numbers count only when the load is under 20. Tests that use a real clock are listed to move to a virtual clock. |
| From about 12:20 to 13:25, every browser test ran against another agent’s copy of the code. | The gate’s dev server found its fixed port taken and failed to start, and nothing checked. | The server takes a free port, proves it started, and refuses to run if the API port is held. |
| A correct change was blamed. Its test failed twice, then passed twice on clean main. | The runs happened one after the other under load, and the test runs on a real 60 Hz timer with 60 ms delays. | Blame a change only after running both trees at the same moment, or by showing that the code paths do not meet. |
| Local API servers disappeared in the middle of tests (about 15:30 to 15:50, for four workers and the gate). | Not proven. Every dev API ran as the same command on the shared port 8795, and we suspect a worker’s cleanup that killed processes by pattern or by port. | Each API now starts from its own one-line wrapper file on its own free port and prints a line if it is gone. Nobody kills processes by pattern. |
| wiki-test, fun-test and box-roll-test failed deploys when they ran into another copy of themselves. About 70 tests shared one database file in /tmp. | Fixed temp file names and fixed ports. | Each process gets its own temp file and a port that is found free at run time. |
| box-roll-test failed 6 of 10 checks. | Its local server refuses rooms when less than 200 MB of memory is free, and the Mac’s free memory fell below that. | It passed 10 of 10 on the retry. Not done yet: the test should set that memory floor itself. |
| Uncommitted edits to three files were lost. | A worker tried to add a worktree at a path that was already taken. That failed silently, and the worker then ran reset --hard and clean there. | Check that the worktree was added and check the top-level path before any reset or clean. |
24 test scripts were red, and a red suite hides any new failure. In 19 of them the test itself was at fault: a later change had made an expectation wrong, or a check failed only on a busy machine. Each fix names the commit that changed the behaviour. Two of the 19 measured something that a later speed-up skips: they counted corrections at replays, and the replay skip had removed those replays.
Five were real bugs. Quick chat phrases after the twelfth had no key. Deleted maps answered 410 instead of 404 or 403, and so they stayed offline. A group’s next game did not start, because the old room stayed alive behind the group page. The end screen lost its result when it drew once more after the result was cleared. Minimum ping rounded its hold time to the nearest tick, so keys arrived up to 20 ms below the minimum.