[PR #2367] rdna2spirv: start a tool again when a Windows job refuses it with ERROR_NOT_ENOUGH_QUOTA (COMPUTE-WORKER-SPAWN-QUOTA) #2369

Open
opened 2026-11-26 21:21:00 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2367
Author: @budanga
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/compute-worker-spawn-quota


📝 Commits (2)

  • 80930f0 rdna2spirv: start a tool again when a Windows job refuses it with ERROR_NOT_ENOUGH_QUOTA (COMPUTE-WORKER-SPAWN-QUOTA)
  • 1860dc5 rdna2spirv: measured 10 s spawn retry budget, and say when it runs out (COMPUTE-WORKER-SPAWN-QUOTA)

📊 Changes

2 files changed (+167 additions, -7 deletions)

View changed files

➕ tests/test_rdna2spirv_spawn_quota.py (+136 -0)
📝 tools/rdna2spirv.py (+31 -7)

📄 Description

Claimed in the coordination issue as: COMPUTE-WORKER-SPAWN-QUOTA (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7196128221)

What and why

scripts/translate_pipeline_compute.py --jobs N on native Windows fails now and then with

OSError: [WinError 1816] Not enough quota is available to process this command
RuntimeError: Windows translation worker failed: [1, None]

and tests/test_translate_pipeline_compute.py (WorkerParity) fails the same way.

Cause: each Windows worker runs in a job that allows two active processes, itself and one tool (TWO_ACTIVE in scripts/compute_workers_win.py). The worker runs spirv-as, then spirv-opt or spirv-val, one after another through _run_spirv_tool in tools/rdna2spirv.py. subprocess.run returns once the previous tool has exited, but the job can still count that process for a moment, so CreateProcess refuses the next tool with ERROR_NOT_ENOUGH_QUOTA (1816).

Measured with a minimal script that makes the job with compute_workers_win.job(mib, True), puts a Python child in it and has the child start a short tool back to back (Windows 11 26300, Python 3.14.10, the machine busy with other work):

spawns refused with 1816
spirv-val --version, in the job 3 x 300 6, 6, 8
cmd /c rem, in the job 3 x 300 23, 28, 15
spirv-val --version, no job 2 x 300 0, 0

Change:

  • _run_spirv_tool starts a tool again when CreateProcess refuses it with winerror 1816, with a doubling delay from 5 ms up to 100 ms, for at most SPAWN_RETRY_SECONDS (10 s); then the error is raised as before, with a note saying how many times the tool was refused and for how long. The refused tool never started, so starting it again repeats nothing. It is the backoff tools/replace_retry.py uses for renames.
  • 10 s is measured: with every hardware thread busy at the workers' priority, the longest run of refusals was 3.76 s (see the review reply for the table).
  • Every other error, and the existing WinError 2 naming, is unchanged.
  • The job's limit of two is left as it is.

New test, tests/test_rdna2spirv_spawn_quota.py (standard library):

  • four unit tests with a faked 1816: refusals are started again with the same arguments; a refusal that lasts is raised once the time is up; other errors are not retried; a missing tool still names itself;
  • one Windows-only test that starts 150 cmd /c rem through _run_spirv_tool inside a job made by compute_workers_win.job(), as the worker does.

On main the new file fails (2 failures, 1 error, including the job test with WinError 1816); with the change it passes.

Tested

On fbf100b1b, Windows 11 Home 26300.9974, Python 3.14.10, SPIRV-Tools v2026.4 (Vulkan SDK 1.4.363.0), with the machine busy translating shaders in the background, as in the table:

  • python -I tests/test_translate_pipeline_compute.py, 12 runs each: main 3 passed, 9 failed (all WinError 1816); this branch 12 passed.
  • python -I tests/test_rdna2spirv_spawn_quota.py: fails on main; passes 7 of 7 runs here.
  • python -m compileall -q make_game.py tools tests: clean.
  • The 56 standard-library test files that use rdna2spirv: all pass. (test_make_game_argparse.py failed once under the load and passed 3 of 3 reruns, on main as well.)
  • python -I scripts/run_semantic_tests.py tests/semantic: 500 files, 6365 tests, 0 files failed.
  • python -I scripts/check_no_game_data.py on both files: passes.

GPUs tested: n/a (no GPU involved)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator rule; this changes how the tools are started)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2367 **Author:** [@budanga](https://github.com/budanga) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/compute-worker-spawn-quota` --- ### 📝 Commits (2) - [`80930f0`](https://github.com/ubiquitarianism/leonida/commit/80930f0d1152dc1aef630a3538caeeea49eba3e7) rdna2spirv: start a tool again when a Windows job refuses it with ERROR_NOT_ENOUGH_QUOTA (COMPUTE-WORKER-SPAWN-QUOTA) - [`1860dc5`](https://github.com/ubiquitarianism/leonida/commit/1860dc591b516e313c9b14fff0b4edf8a0e6ad74) rdna2spirv: measured 10 s spawn retry budget, and say when it runs out (COMPUTE-WORKER-SPAWN-QUOTA) ### 📊 Changes **2 files changed** (+167 additions, -7 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_rdna2spirv_spawn_quota.py` (+136 -0) 📝 `tools/rdna2spirv.py` (+31 -7) </details> ### 📄 Description Claimed in the coordination issue as: COMPUTE-WORKER-SPAWN-QUOTA (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7196128221) ### What and why `scripts/translate_pipeline_compute.py --jobs N` on native Windows fails now and then with ``` OSError: [WinError 1816] Not enough quota is available to process this command RuntimeError: Windows translation worker failed: [1, None] ``` and `tests/test_translate_pipeline_compute.py` (`WorkerParity`) fails the same way. Cause: each Windows worker runs in a job that allows two active processes, itself and one tool (`TWO_ACTIVE` in `scripts/compute_workers_win.py`). The worker runs spirv-as, then spirv-opt or spirv-val, one after another through `_run_spirv_tool` in `tools/rdna2spirv.py`. `subprocess.run` returns once the previous tool has exited, but the job can still count that process for a moment, so `CreateProcess` refuses the next tool with ERROR_NOT_ENOUGH_QUOTA (1816). Measured with a minimal script that makes the job with `compute_workers_win.job(mib, True)`, puts a Python child in it and has the child start a short tool back to back (Windows 11 26300, Python 3.14.10, the machine busy with other work): | | spawns | refused with 1816 | |---|---:|---:| | `spirv-val --version`, in the job | 3 x 300 | 6, 6, 8 | | `cmd /c rem`, in the job | 3 x 300 | 23, 28, 15 | | `spirv-val --version`, no job | 2 x 300 | 0, 0 | Change: - `_run_spirv_tool` starts a tool again when `CreateProcess` refuses it with winerror 1816, with a doubling delay from 5 ms up to 100 ms, for at most `SPAWN_RETRY_SECONDS` (10 s); then the error is raised as before, with a note saying how many times the tool was refused and for how long. The refused tool never started, so starting it again repeats nothing. It is the backoff `tools/replace_retry.py` uses for renames. - 10 s is measured: with every hardware thread busy at the workers' priority, the longest run of refusals was 3.76 s (see the review reply for the table). - Every other error, and the existing WinError 2 naming, is unchanged. - The job's limit of two is left as it is. New test, `tests/test_rdna2spirv_spawn_quota.py` (standard library): - four unit tests with a faked 1816: refusals are started again with the same arguments; a refusal that lasts is raised once the time is up; other errors are not retried; a missing tool still names itself; - one Windows-only test that starts 150 `cmd /c rem` through `_run_spirv_tool` inside a job made by `compute_workers_win.job()`, as the worker does. On `main` the new file fails (2 failures, 1 error, including the job test with WinError 1816); with the change it passes. ### Tested On `fbf100b1b`, Windows 11 Home 26300.9974, Python 3.14.10, SPIRV-Tools v2026.4 (Vulkan SDK 1.4.363.0), with the machine busy translating shaders in the background, as in the table: - `python -I tests/test_translate_pipeline_compute.py`, 12 runs each: `main` 3 passed, 9 failed (all WinError 1816); this branch 12 passed. - `python -I tests/test_rdna2spirv_spawn_quota.py`: fails on `main`; passes 7 of 7 runs here. - `python -m compileall -q make_game.py tools tests`: clean. - The 56 standard-library test files that use `rdna2spirv`: all pass. (`test_make_game_argparse.py` failed once under the load and passed 3 of 3 reruns, on `main` as well.) - `python -I scripts/run_semantic_tests.py tests/semantic`: 500 files, 6365 tests, 0 files failed. - `python -I scripts/check_no_game_data.py` on both files: passes. GPUs tested: n/a (no GPU involved) AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator rule; this changes how the tools are started) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
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
starred/leonida#2369
No description provided.