0.6.6: lambdas that capture a throwing copy terminate under /Zc:lambda; audit the in-game tree
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 46/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- cmake, cpp
- Domínio
- backend, testing-qa
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- C++
- Estrelas
- 12
- Forks
- 2
- Merge médio
- 3h 10min
- PRs com merge (30d)
- 171
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de phantoslayer21/wronggpu
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
phantoslayer21/wronggpu#275 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
phantoslayer21/wronggpu#274 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
phantoslayer21/wronggpu#241 ·
Mantenedores costumam responder em até 1 dia
-
bug build
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
phantoslayer21/wronggpu#234 ·
Mantenedores costumam responder em até 1 dia
-
Launcher tests: "an older record: update available" fakes a version newer than the test buildAbertabug build
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
phantoslayer21/wronggpu#233 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de phantoslayer21/wronggpu
Issues semelhantes
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 77/100
Mantenedores costumam responder em até 1 dia
-
bug good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
ReyeMe/SaturnRingLib#155 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Nheko-Reborn/nheko#2092 ·
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 78/100
isocpp/CppCoreGuidelines#2345 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 71/100
ROCm/rocm-libraries#16108 ·
Mantenedores costumam responder em até 2 dias