GPU-TIMEOUT-OVERFLOW: Reject GPU timeouts that overflow platform waits #1350

Closed
delysidemanYT1 wants to merge 1 commit from upstream-pr/1350 into main
delysidemanYT1 commented 2026-11-24 22:12:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by delysidemanYT1 on 2026-11-24T22:12:32Z.


Claimed in the coordination issue as: GPU-TIMEOUT-OVERFLOW
Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145900346

Reject finite positive LEONIDA_GPU_TEST_TIMEOUT values above the signed 32-bit millisecond wait limit before launching a subprocess. Preserve the default, fractional timeouts and the existing unlimited setting.

Reproduced the Windows OverflowError at 1e300. Checked seven accepted and rejected boundary cases with synthetic subprocesses. All eight GPU timeout unit tests passed. No GPU run. git diff --check passed. No game files. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5481197670 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1350). Originally posted by [delysidemanYT1](https://github.com/delysidemanYT1) on 2026-11-24T22:12:32Z. --- Claimed in the coordination issue as: GPU-TIMEOUT-OVERFLOW Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145900346 Reject finite positive LEONIDA_GPU_TEST_TIMEOUT values above the signed 32-bit millisecond wait limit before launching a subprocess. Preserve the default, fractional timeouts and the existing unlimited setting. Reproduced the Windows OverflowError at 1e300. Checked seven accepted and rejected boundary cases with synthetic subprocesses. All eight GPU timeout unit tests passed. No GPU run. git diff --check passed. No game files. AI-assisted (Codex).
whoalin1 commented 2026-11-24 23:25:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-24T23:25:52Z.


Independent verification (AI-assisted, overnight review batch):

  • Checked out 5ca1539; diff is a single guard in runtime/test/shaders/check.py:694-697 (gpu_test_timeout).
  • Manual boundary checks (CPython 3.14.4, Windows): 1e300 now exits with the new diagnostic; 2147483 accepted, 2147483.5/2147484 rejected, 0/-1 still mean no limit, 0.5 accepted, non-numeric/nan still rejected by the existing check.
  • Reproduced the underlying hazard on this Python: subprocess.run(..., timeout=1e300) misbehaves (raises TimeoutExpired immediately rather than waiting), confirming huge timeouts break platform waits.
  • python -I -m pytest tests/test_gpu_test_timeout.py: 8 passed + 7 subtests.
  • py -3.14 -m compileall -q tools tests make_game.py: clean.
  • Minor note (non-blocking): the bound (2**31-1)//1000 = 2147483 is slightly conservative — 2147483.5 s would still fit in a signed 32-bit ms wait — but a ~24-day timeout difference is irrelevant in practice.
  • CPU only, no GPU, no game files. LGTM.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147391083 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1350#issuecomment-7147391083). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-24T23:25:52Z. --- Independent verification (AI-assisted, overnight review batch): - Checked out 5ca1539; diff is a single guard in `runtime/test/shaders/check.py:694-697` (`gpu_test_timeout`). - Manual boundary checks (CPython 3.14.4, Windows): `1e300` now exits with the new diagnostic; `2147483` accepted, `2147483.5`/`2147484` rejected, `0`/`-1` still mean no limit, `0.5` accepted, non-numeric/`nan` still rejected by the existing check. - Reproduced the underlying hazard on this Python: `subprocess.run(..., timeout=1e300)` misbehaves (raises TimeoutExpired immediately rather than waiting), confirming huge timeouts break platform waits. - `python -I -m pytest tests/test_gpu_test_timeout.py`: 8 passed + 7 subtests. - `py -3.14 -m compileall -q tools tests make_game.py`: clean. - Minor note (non-blocking): the bound `(2**31-1)//1000 = 2147483` is slightly conservative — 2147483.5 s would still fit in a signed 32-bit ms wait — but a ~24-day timeout difference is irrelevant in practice. - CPU only, no GPU, no game files. LGTM.
OreoFR commented 2026-11-28 21:49:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:49:15Z.


Verified by OreoFR

  • Base: main 3408969a7 + PR head 5ca153985; green run in a merge package of 3 PRs, no new ctest failure vs main
  • Test: python -I tests/test_gpu_test_timeout.py (from #1382)
  • Red on main: 2 FAIL (SystemExit not raised for 2147484 and 1e300)
  • Green with the PR: 9 tests OK
  • Verdict: READY (the test comes from #1382 (this PR has none); merge with or before #1382, which contains it)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246297909 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1350#issuecomment-7246297909). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:49:15Z. --- **Verified by OreoFR** - Base: main `3408969a7` + PR head `5ca153985`; green run in a merge package of 3 PRs, no new ctest failure vs main - Test: `python -I tests/test_gpu_test_timeout.py (from #1382)` - Red on main: 2 FAIL (SystemExit not raised for 2147484 and 1e300) - Green with the PR: 9 tests OK - Verdict: READY (the test comes from #1382 (this PR has none); merge with or before #1382, which contains it) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 01:12:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:12:24Z.


#1350 | head 5ca153985e (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11)

  • Diff & safety audit: Inspected 100% of the diff in runtime/test/shaders/check.py capping LEONIDA_GPU_TEST_TIMEOUT at (2**31 - 1) // 1000 (2147483 seconds) in gpu_test_timeout(). python -I scripts/check_no_game_data.py runtime/test/shaders/check.py passed (rc=0).
  • Red -> Green on Windows 11:
    • Red (origin/main 818d881b1f): Setting LEONIDA_GPU_TEST_TIMEOUT=5000000 and invoking check.run(...) on Windows 11 crashed inside subprocess / Win32 WaitForSingleObject with unhandled OverflowError: timeout value is too large.
    • Green (#1350 + origin/main):
      • LEONIDA_GPU_TEST_TIMEOUT=5000000 exited cleanly with SystemExit("LEONIDA_GPU_TEST_TIMEOUT must not exceed 2147483 seconds (0 = no limit), not '5000000'").
      • Boundary LEONIDA_GPU_TEST_TIMEOUT=2147483 returned 2147483.0 and check.run(...) executed cleanly (rc=0).
  • Regression suite & sibling merge check:
    • python -I tests/test_shader_checks.py -> 88/88 passed (OK, 2.177s)
    • Verified clean 3-way merge alongside sibling runtime/test/shaders/check.py PR #1325 (0 conflicts).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248630893 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1350#issuecomment-7248630893). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:12:24Z. --- #1350 | head 5ca153985e4f261c01685a6c7cf2b69205439d95 (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes ### Independent Verification (Windows 11) - **Diff & safety audit**: Inspected 100% of the diff in `runtime/test/shaders/check.py` capping `LEONIDA_GPU_TEST_TIMEOUT` at `(2**31 - 1) // 1000` (`2147483` seconds) in `gpu_test_timeout()`. `python -I scripts/check_no_game_data.py runtime/test/shaders/check.py` passed (`rc=0`). - **Red -> Green on Windows 11**: - **Red (`origin/main` `818d881b1f`)**: Setting `LEONIDA_GPU_TEST_TIMEOUT=5000000` and invoking `check.run(...)` on Windows 11 crashed inside `subprocess` / Win32 `WaitForSingleObject` with unhandled `OverflowError: timeout value is too large`. - **Green (`#1350 + origin/main`)**: - `LEONIDA_GPU_TEST_TIMEOUT=5000000` exited cleanly with `SystemExit("LEONIDA_GPU_TEST_TIMEOUT must not exceed 2147483 seconds (0 = no limit), not '5000000'")`. - Boundary `LEONIDA_GPU_TEST_TIMEOUT=2147483` returned `2147483.0` and `check.run(...)` executed cleanly (`rc=0`). - **Regression suite & sibling merge check**: - `python -I tests/test_shader_checks.py` -> `88/88` passed (`OK`, `2.177s`) - Verified clean 3-way merge alongside sibling `runtime/test/shaders/check.py` PR `#1325` (`0` conflicts).
aslan2142 commented 2026-12-01 16:35:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:35:01Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317846060 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1350#issuecomment-7317846060). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:35:01Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1350
No description provided.