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

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

📋 Pull Request Information

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

Base: main ← Head: fix/pipeline-workers-rethrow-wine


📝 Commits (1)

  • dc52918 pipeline_workers: keep the rethrown error alive across the throw, for Wine 11.0's rethrow_exception

📊 Changes

1 file changed (+8 additions, -1 deletions)

View changed files

📝 runtime/src/pipeline_workers.h (+8 -1)

📄 Description

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


🔄 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/2374 **Author:** [@Tauwni](https://github.com/Tauwni) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/pipeline-workers-rethrow-wine` --- ### 📝 Commits (1) - [`dc52918`](https://github.com/ubiquitarianism/leonida/commit/dc52918a5174725b2b2b973a81030dc8574aa4af) pipeline_workers: keep the rethrown error alive across the throw, for Wine 11.0's rethrow_exception ### 📊 Changes **1 file changed** (+8 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/pipeline_workers.h` (+8 -1) </details> ### 📄 Description 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) --- <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#2376
No description provided.