pipeline_workers: keep the rethrown error alive for Wine 11.0's rethrow_exception; pipeline_workers passes under Wine #2374

Open
github-bot wants to merge 2 commits from github-bot/gh-2374 into main AGit
Owner

@⁠Tauwni on GitHub · 2026-11-26 16:26 UTC · original
Tauwni:fix/pipeline-workers-rethrow-wine → main · +8 −1 · 1 files · 2 commits · draft

Under Wine 11.0, pipeline_workers fails every round of its exceptions() case ("run() rethrew no exception, or not the lowest job's"). On native Windows and macOS it passes.

PipelineWorkers::run() (runtime/src/pipeline_workers.h) keeps the lowest job's error in the exception_ptr of a Batch on its own stack and ends with std::rethrow_exception(batch.error). Wine 11.0's rethrow_exception throws the stored object itself, not a copy. So the unwinding out of run() destroys batch, frees that object while it is still in flight, and the caller's catch (const std::runtime_error&) never sees it. #1086 found the same Wine behaviour in gta6rt's DllMain failure path and keeps a copy there.

Here the error type is whatever a job throws, so a copy of a known type doesn't fit. Instead, a thread_local std::exception_ptr takes the error just before the rethrow and keeps the object alive until that thread's next error. Nothing else changes: the lowest-index rule, the stop and the inline path for one job stay as they are.

Tested on an Apple M3 (macOS 26.5.1) at main fbf100b1b:

pipeline_workers the 18 tests matching pipeline
Wine 11.0 (WineHQ macOS build, x86-64 under Rosetta), clang-cl/lld-link 23.1.6 cross build, xwin SDK 10.0.26100 FAIL on main; PASS with this, 3 runs out of 3 16 pass; vk_pipeline_check_cli (a timeout) and pipeline_cache_seed fail with and without this change
native macOS, Apple clang 17 PASS (as on main) 10/10 pass, no new warnings

d3d12_pipeline_workers, d3d12_pipeline_workers_eager and replay_pipeline_compiles*, which run through PipelineWorkers, pass under Wine with this change.

AI-assisted (Claude Code). No game data.

🤖 Generated with Claude Code

**@⁠Tauwni** on GitHub · 2026-11-26 16:26 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2374) `Tauwni:fix/pipeline-workers-rethrow-wine` → `main` · +8 −1 · 1 files · 2 commits · draft Under Wine 11.0, `pipeline_workers` fails every round of its `exceptions()` case ("run() rethrew no exception, or not the lowest job's"). On native Windows and macOS it passes. `PipelineWorkers::run()` (`runtime/src/pipeline_workers.h`) keeps the lowest job's error in the `exception_ptr` of a `Batch` on its own stack and ends with `std::rethrow_exception(batch.error)`. Wine 11.0's `rethrow_exception` throws the stored object itself, not a copy. So the unwinding out of `run()` destroys `batch`, frees that object while it is still in flight, and the caller's `catch (const std::runtime_error&)` never sees it. #1086 found the same Wine behaviour in `gta6rt`'s `DllMain` failure path and keeps a copy there. Here the error type is whatever a job throws, so a copy of a known type doesn't fit. Instead, a `thread_local std::exception_ptr` takes the error just before the rethrow and keeps the object alive until that thread's next error. Nothing else changes: the lowest-index rule, the stop and the inline path for one job stay as they are. Tested on an Apple M3 (macOS 26.5.1) at `main` `fbf100b1b`: | | `pipeline_workers` | the 18 tests matching `pipeline` | |---|---|---| | Wine 11.0 (WineHQ macOS build, x86-64 under Rosetta), clang-cl/lld-link 23.1.6 cross build, xwin SDK 10.0.26100 | FAIL on `main`; PASS with this, 3 runs out of 3 | 16 pass; `vk_pipeline_check_cli` (a timeout) and `pipeline_cache_seed` fail with and without this change | | native macOS, Apple clang 17 | PASS (as on `main`) | 10/10 pass, no new warnings | `d3d12_pipeline_workers`, `d3d12_pipeline_workers_eager` and `replay_pipeline_compiles*`, which run through `PipelineWorkers`, pass under Wine with this change. AI-assisted (Claude Code). No game data. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Wine 11.0's rethrow_exception throws the stored object itself, not a copy.
run() rethrew batch.error, the exception_ptr of a local Batch, which the
unwinding then freed, so the caller caught no runtime_error. A thread_local
exception_ptr now holds the object until the thread's next error. Same Wine
bug as gta6rt's DllMain failure (#1086).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:29:05 +00:00
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/2374/head:github-bot/gh-2374'
git switch 'github-bot/gh-2374'

Merge

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