runtime: keep query recording state consistent after allocation failure (OLD-9806) #1107

Open
github-bot wants to merge 1 commit from github-bot/gh-1107 into main AGit
Owner

@⁠ambroseautomation on GitHub · 2026-11-24 18:37 UTC · original
ambroseautomation:carry/old-9806-query-oom → main · +105 −1 · 3 files · 1 commits · open

Claimed in the coordination issue as: OLD-9806 (#14)

What and why

Carries forward old-pr/9806 (draft #79, original commit author WebIdentity1 preserved; indexed in #17), rebased cleanly onto current main (71f99e224).

Fixes strong exception safety in CommandList::begin_query and CommandList::end_query (runtime/src/command_list.h):

  • begin_query: rolls back active_.pop_back() if append(query) throws (e.g., std::bad_alloc), preventing a leaked active-query entry that would permanently block close() or retrying the query.
  • end_query: calls append(query) before erasing the entry from active_, so an allocation failure leaves the query active and retryable.
  • Adds runtime/test/command_list_query_oom_test.cpp and registers command_list_query_oom in runtime/CMakeLists.txt.

Tested

  • Compiled and ran command_list_query_oom_test.exe natively on Windows 11 with MSVC (/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2): exit 0, zero compiler warnings.
  • Compiled and ran command_list_test.exe with the same flags: exit 0, zero compiler warnings.
  • python -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/src/command_list.h runtime/test/command_list_query_oom_test.cpp: exit 0 (no game data).

GPUs tested: n/a (CPU-only command-list IR test; built and tested on Windows 11 Pro 64-bit, MSVC VS 18)

AI-assisted: yes

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 — runtime command-list IR)
**@⁠ambroseautomation** on GitHub · 2026-11-24 18:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1107) `ambroseautomation:carry/old-9806-query-oom` → `main` · +105 −1 · 3 files · 1 commits · open Claimed in the coordination issue as: OLD-9806 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Carries forward `old-pr/9806` (draft #79, original commit author `WebIdentity1` preserved; indexed in #17), rebased cleanly onto current `main` (`71f99e224`). Fixes strong exception safety in `CommandList::begin_query` and `CommandList::end_query` (`runtime/src/command_list.h`): - `begin_query`: rolls back `active_.pop_back()` if `append(query)` throws (e.g., `std::bad_alloc`), preventing a leaked active-query entry that would permanently block `close()` or retrying the query. - `end_query`: calls `append(query)` before erasing the entry from `active_`, so an allocation failure leaves the query active and retryable. - Adds `runtime/test/command_list_query_oom_test.cpp` and registers `command_list_query_oom` in `runtime/CMakeLists.txt`. ### Tested - Compiled and ran `command_list_query_oom_test.exe` natively on Windows 11 with MSVC (`/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2`): exit 0, zero compiler warnings. - Compiled and ran `command_list_test.exe` with the same flags: exit 0, zero compiler warnings. - `python -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/src/command_list.h runtime/test/command_list_query_oom_test.cpp`: exit 0 (no game data). GPUs tested: n/a (CPU-only command-list IR test; built and tested on Windows 11 Pro 64-bit, MSVC VS 18) AI-assisted: yes ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a — runtime command-list IR)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:38:35 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:38 UTC · original · approved these changes

Audited and verified. Guarantees strong exception safety in CommandList::begin_query and end_query by rolling back ctive_ state on allocation failure. Unit tests in
untime/test/command_list_query_oom_test.cpp verify fault injection behavior. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1107#pullrequestreview-6045188756) · **approved these changes** Audited and verified. Guarantees strong exception safety in CommandList::begin_query and end_query by rolling back ctive_ state on allocation failure. Unit tests in untime/test/command_list_query_oom_test.cpp verify fault injection behavior. Approved.
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 19:35 UTC · original

Tested 53c1c4c02 on Arch Linux:

  • ctest --test-dir runtime/build/linux -R "^(command_list_query_oom|command_list)$" --output-on-failure: 2/2 passed (0.00 s)

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 19:35 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1107#issuecomment-7142326727) Tested `53c1c4c02` on Arch Linux: - `ctest --test-dir runtime/build/linux -R "^(command_list_query_oom|command_list)$" --output-on-failure`: **2/2 passed** (0.00 s) AI-assisted: yes
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:17 UTC · original

Recommendation: [MERGE]

Reasoning: Carries #79: strong exception safety in CommandList::begin_query/end_query, so a bad_alloc during append no longer leaves a dangling active query that blocks close(). Small change (+8/-1) with a dedicated OOM test. Verified on Linux by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 3/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1107#issuecomment-7143308464) **Recommendation:** [MERGE] **Reasoning:** Carries #79: strong exception safety in `CommandList::begin_query`/`end_query`, so a `bad_alloc` during append no longer leaves a dangling active query that blocks `close()`. Small change (+8/-1) with a dedicated OOM test. Verified on Linux by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 3/10
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1107/head:github-bot/gh-1107'
git switch 'github-bot/gh-1107'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1107'
git switch 'github-bot/gh-1107'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1107'
git switch 'github-bot/gh-1107'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1107'
git switch 'main'
git merge --squash 'github-bot/gh-1107'
git switch 'main'
git merge --ff-only 'github-bot/gh-1107'
git switch 'main'
git merge 'github-bot/gh-1107'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.