Browse documentation

Every test262 run has a worker process of its own on every platform

Date: 2026-11-29 Area: test262, cli, errors Supersedes: the "GocciaTest262Runner without fork" exception of ADR 0201 ("On Windows the cases run in the coordinator's process, and the run goes on after a crash outcome"); ADR 0201's other decisions stand. Related: ADR 0120, test262, #2366

Context

GocciaTest262Runner ran each test262 case in a process of its own only where it could fork. On POSIX the coordinator forked a child per run, which ran the case, wrote its result to a file and exited, and the coordinator killed it at --timeout. Elsewhere, Windows included, each case ran on a thread of the coordinator with a 64 MiB stack, bounded by the engine's cooperative deadline, and cases that use $262.agent ran one at a time behind a lock, because agents share one queue per process.

So a crash meant different things on different platforms. A Pascal exception inside the engine is graded as the case's crash outcome on both, but on Windows the next cases then ran in the process the exception had come through. A fault that ends a process, such as one of the engine's own integrity checks (StopOnEngineCheck, exit 70), ended one case on POSIX and the whole run on Windows, with no summary and no report. ADR 0201 recorded this as the one place where a run goes on after an engine fault.

Three answers were weighed: keep it; stop the whole run at the first crash with exit 70, as every other application does; or run each case in its own child process on Windows too.

Decision

Johannes chose the third (29 November 2026, "Let's go with C, I want the same behaviour cross platform").

Each run has a worker process of its own, and the coordinator grades how it ended the same way on every platform. How the worker is made is the runner's --isolation:

  • fork (POSIX only, the default there) forks the coordinator, as before.
  • process (the only one on Windows) starts the runner's own executable again with --worker for that one run. Its command line names the case (--case, --case-mode), the result file (--result) and the settings the run reads (--suite-dir, --max-memory, the profile options). Its standard output and error are the null device, opened once by the coordinator and handed to each worker; it inherits standard input, as a forked worker does. It writes its result to the same result file a forked worker writes, in the same format, and ends at once (TerminateProcessNow), running no unit finalization, as a forked worker ends with fpExit. On Windows it first sets its error mode so that a crash ends it at once, with no error dialog to wait out the timeout.

Both share the grading (RecordWorkerEnd): the result file when the worker exited with 0; TIMEOUT when the coordinator killed it at --timeout; otherwise WRAPPER_INFRA naming how it ended, Test262 worker exited with status N or, on POSIX, Test262 worker terminated by signal N (a Windows exception code above 255 also shows in hex). A Pascal exception inside the engine stays the case's crash outcome, a FAIL, inside its worker.

The limits are the same on every platform. The timeout is the coordinator's kill of the worker (SIGKILL on POSIX, TerminateProcess on Windows), not the engine's deadline. The memory limit is the engine's heap ceiling inside the worker (--max-memory). --jobs is the number of workers running at once. The coordinator waits for a worker to end with waitpid on POSIX and WaitForMultipleObjects on Windows, bounded by the nearest deadline, since a Sleep(1) there lasts a whole timer tick. A case runs on its worker's main thread, whose native stack is the platform's: 8 MiB on the Linux and macOS runners, 16 MiB on Windows (FPC's default reserve), where the thread had 64 MiB.

No Job Object. A Job Object could cap a worker's memory and end every worker with the coordinator. POSIX has neither: its memory limit is the engine's, and a forked worker outlives a coordinator that dies. A worker starts no process of its own, so nothing else needs a Job Object to be reached.

The process path runs on POSIX too. --isolation=process there runs the same code Windows runs, so the Linux and macOS CI jobs check it, and its reports can be compared with fork's. Over the 48,877 runs of language, annexB and staging at the test262 pin, and the 6,123 of built-ins/Array, the two gave the same status and message for every run. On Linux it took about 11% longer than fork (47.1 s against 42.5 s for the 48,877 runs, eight jobs), which is why fork stays POSIX's default.

Consequences

  • A crash inside a case ends only that case's worker on every platform, and the runs after it run in a coordinator it never touched. Every application now stops on an engine fault or keeps it inside a process of its own; ADR 0201's list of what it does not reach loses its test262 entry.
  • The Windows run serializes nothing: cases that use $262.agent run in processes of their own, as on POSIX, so the lock that kept them one at a time is gone, with the thread path.
  • A run on Windows pays for starting a process per case. The full conformance job runs only on Linux, so this changes no published number; the PR that made this change measured the cost on a CI Windows runner.
  • scripts/test-engine-faults.ts checks the contract on every CI platform with the fault build: a run whose cases pass, raise an access violation, fail an engine check and hang is graded PASS, FAIL (crash EAccessViolation), WRAPPER_INFRA (exited with status 70), TIMEOUT and PASS, with the summary and report written, the same under every isolation and job count. Before this change the Windows run stopped at the engine check with exit 70.
  • FPC's own null-device option for a child (iotNull) opens /dev/null for reading with an exclusive flock on POSIX, which the child holds for its whole life, so only one worker could start at a time and a start could fail. The coordinator opens the null device itself instead.