0.6.6: lambdas that capture a throwing copy terminate under /Zc:lambda; audit the in-game tree
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 46/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- cmake, cpp
- 领域
- backend, testing-qa
调研方向
Start with clean/fsr/src/dllmain.cpp and compare its modelPlaces capture with DeviceRelease in clean/fsr/src/async_create.h; then audit the in-game tree listed in the issue for other throwing lambda captures. Read the contributor notes for the existing code rules and inspect TestDeviceHoldAllocationFailure in clean/fsr/tests/test_frontend.cpp. Done means all identified sites follow the proposed rule, the rule is documented, and the relevant throwing-copy test passes in the CI configuration.
由索引模型根据 Issue 内容生成。
描述
What
With MSVC's /Zc:lambda, a lambda whose capture copy throws terminates the process (std::terminate) instead of unwinding to the caller's handler. /Zc:lambda is on whenever /permissive- is, and the CMake targets of the front end build with /permissive-, so every release build of the in-game code has it on. A capture copy can throw whenever the captured object allocates when it is copied (std::string, std::vector, std::function holding a large callable): the throw is std::bad_alloc, so the case is out of memory, and the process ends in std::terminate instead of the error path.
It was found in the create worker's device hold (#225): [release, device] { release(device); } captured a std::function by copy. A test with a callable whose copy throws aborted with exit code 0xc0000409 in the CI configuration (cmake, Release, /permissive- /W4 /Zi) and not in a hand-made cl build without /permissive-. A stand-alone reproduction narrowed it to this switch: with /Zc:lambda alone the throw terminates, without it the exception reaches the catch; a plain copy of the same std::function (no lambda) is fine in every configuration.
Rule (proposed)
No lambda in code that runs in a game may capture, by copy or by init-capture, an object whose copy can throw. Use one of:
- a named callable class whose constructor does the copy (that unwinds normally; #225 does this:
DeviceReleaseinclean/fsr/src/async_create.h), or - a capture whose copy cannot throw: a raw pointer, an index, a
std::shared_ptr(copy isnoexcept), or astd::moveinto an init-capture of a type with anoexceptmove.
Known site
clean/fsr/src/dllmain.cpp: p.modelPlaces = [modelDir = config.modelDir] { ... } init-captures a std::string by copy at start-up. Out of memory at that point ends in std::terminate instead of the normal failure. It is the same class; it is not part of #225.
Asked for (0.6.6)
- Audit the whole in-game tree (front end, the D3D12 runtime and its interop, the Ray Reconstruction plugin and runtime, shared code that runs in the game process) for lambdas with a by-copy or init-capture of a type whose copy can throw; fix each as above.
- Write the rule in the contributor notes next to the other code rules.
- Optional: a small CI check (a grep for init-captures of
std::string/std::vector/std::functionin the in-game sources) so the rule holds. - Keep a test that drives a throwing copy through any callable the fix touches (see
TestDeviceHoldAllocationFailureinclean/fsr/tests/test_frontend.cpp): it must pass in the CI configuration.
- 主要语言
- C++
- 星标
- 12
- 派生
- 2
- 平均合并
- 3 小时 10 分钟
- 30 天内合并 PR
- 171
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
phantoslayer21/wronggpu 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
phantoslayer21/wronggpu#275 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
phantoslayer21/wronggpu#274 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
phantoslayer21/wronggpu#241 ·
维护者通常 1 天内回复
-
bug build
难度 2/5 1-3 小时 新手友好度 74/100
phantoslayer21/wronggpu#234 ·
维护者通常 1 天内回复
-
bug build
难度 2/5 1-3 小时 新手友好度 80/100
phantoslayer21/wronggpu#233 ·
维护者通常 1 天内回复
查看 phantoslayer21/wronggpu 的全部 Issue
相似的 Issue
-
ai_p2
难度 2/5 1-3 小时 新手友好度 80/100
ClickHouse/ClickHouse#132519 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
juce-framework/JUCE#1810 ·
-
难度 1/5 1 小时以内 新手友好度 82/100
petercorke/robotics-toolbox-python#952 ·
维护者通常 1 天内回复
-
NatronRenderer: a Python error in the script (-t / project script) doesn't change the exit status未关闭func:engine type:bug
难度 2/5 1-3 小时 新手友好度 72/100
NatronGitHub/Natron#1276 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复