Windows: tests/run_all.py dies without a word, test_job_queue sends a Ctrl+C to its console #2303

Closed
opened 2026-11-22 21:33:38 +00:00 by mmkzero · 1 comment
Contributor

On Windows, tests/run_all.py dies part-way through without a word: no summary, no failure, no exit code. The shell or
window it runs in goes with it. The cause is a Ctrl+C that tests/test_job_queue.py sends to its own console.

How it happens (main @ 753fb5af)

  • Environment.test_places_every_version_shares patches common.WINDOWS to False to check the Linux paths, then
    calls procs.proc_start(os.getpid()) (tests/test_job_queue.py:137, :147).
  • With WINDOWS off, proc_start tries /proc, fails, and falls back to os.kill(pid, 0)
    (scripts/devtools/procs.py:76).
  • On Windows, signal 0 is CTRL_C_EVENT: os.kill(pid, 0) calls GenerateConsoleCtrlEvent, which delivers a Ctrl+C
    to every process attached to the console. That includes run_all.py, the shell that started it and any wrapper, so all
    of them end at once.

To see it

python -I -B tests/run_all.py test_job_queue in a console: run_all.py and the shell running it end, with no summary.
A run of the whole suite stops after a few hundred results, always when test_job_queue runs (this PC: 16 at once,
about 270 results in).

A Python started the normal way (sharing the console) that calls os.kill(os.getpid(), 0) reaches its parent: the
parent's SIGINT handler fires. Only the first process of a new console gets OSError 87 instead.

Since

#1802 (068fb8eb), which added the test. CI runs run_all.py on Linux only (and only by hand), so it never showed there.

Fix

In proc_start, never take the os.kill(pid, 0) fallback on Windows: check the real platform (os.name == "nt"),
not common.WINDOWS, which tests patch. A pull request with a test that fails on main follows.

On Windows, `tests/run_all.py` dies part-way through without a word: no summary, no failure, no exit code. The shell or window it runs in goes with it. The cause is a Ctrl+C that `tests/test_job_queue.py` sends to its own console. **How it happens (main @ 753fb5af)** - `Environment.test_places_every_version_shares` patches `common.WINDOWS` to `False` to check the Linux paths, then calls `procs.proc_start(os.getpid())` (tests/test_job_queue.py:137, :147). - With `WINDOWS` off, `proc_start` tries `/proc`, fails, and falls back to `os.kill(pid, 0)` (scripts/devtools/procs.py:76). - On Windows, signal 0 is `CTRL_C_EVENT`: `os.kill(pid, 0)` calls `GenerateConsoleCtrlEvent`, which delivers a Ctrl+C to every process attached to the console. That includes run_all.py, the shell that started it and any wrapper, so all of them end at once. **To see it** `python -I -B tests/run_all.py test_job_queue` in a console: run_all.py and the shell running it end, with no summary. A run of the whole suite stops after a few hundred results, always when test_job_queue runs (this PC: 16 at once, about 270 results in). A Python started the normal way (sharing the console) that calls `os.kill(os.getpid(), 0)` reaches its parent: the parent's SIGINT handler fires. Only the first process of a new console gets `OSError 87` instead. **Since** #1802 (068fb8eb), which added the test. CI runs run_all.py on Linux only (and only by hand), so it never showed there. **Fix** In `proc_start`, never take the `os.kill(pid, 0)` fallback on Windows: check the real platform (`os.name == "nt"`), not `common.WINDOWS`, which tests patch. A pull request with a test that fails on main follows.
Member

Possibly related, for context:

  • PR #1046 fix(cheats): a debug teleport the game dropped is sent once more, so the control bridge's teleport arrives — Windows test_job_queue run documented as triggering shared-console Ctrl+C
  • PR #1523 fix(queue): on Windows the job queue waits for a player and sees builds outside it, as on Linux — job queue change added/expanded the Windows test coverage implicated here
  • PR #1495 fix(tests): run_all ends every process a check started, on Linux — run_all process-management changes are adjacent; this PR was Linux-only
Possibly related, for context: - PR #1046 fix(cheats): a debug teleport the game dropped is sent once more, so the control bridge's teleport arrives — Windows test_job_queue run documented as triggering shared-console Ctrl+C - PR #1523 fix(queue): on Windows the job queue waits for a player and sees builds outside it, as on Linux — job queue change added/expanded the Windows test coverage implicated here - PR #1495 fix(tests): run_all ends every process a check started, on Linux — run_all process-management changes are adjacent; this PR was Linux-only
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot#2303
No description provided.