Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inadequate unwind protection for log calls under DX12 #2487

Closed
Xaeroxe opened this issue Feb 17, 2022 · 1 comment · Fixed by #2511
Closed

Inadequate unwind protection for log calls under DX12 #2487

Xaeroxe opened this issue Feb 17, 2022 · 1 comment · Fixed by #2511
Labels
good first issue Good for newcomers help required We need community help to make this happen. type: bug Something isn't working

Comments

@Xaeroxe
Copy link

Xaeroxe commented Feb 17, 2022

Description
The log macros and functions are internally calls out to "whatever zany stuff the Rust ecosystem has dreamt up" so it's nearly impossible to prove they won't panic. Currently wgpu is using log while behind FFI in at least one instance and this is causing dead locks when used with log4rs. log4rs will spawn a thread to roll its file over as part of its rolling_file functionality. After the Rust runtime has called ExitProcess from Win32 the aforementioned wgpu FFI code is still running. However, Windows does not permit you to spawn a thread after ExitProcess has been called, so this log statement panics and hangs indefinitely.

Repro steps
Add log4rs logging using a rolling file appender to a wgpu program using only the DX12 backend, and set the size at which it rolls over to a very small size such that it is rolling over very often. Do not filter warn level logs from wgpu. Use the log_panics crate to log panics as well. Start and stop the program repeatedly. Eventually it should hang.
Attaching a debugger to it will reveal that it has hung due to a panic on a log statement behind FFI.

Expected vs observed behavior
I expected that wgpu would catch_unwind to catch any potential log panic, and then either do nothing, or abort.

Platform
Windows 11, wgpu 0.11, rustc 1.58.1

@kvark kvark added good first issue Good for newcomers help required We need community help to make this happen. type: bug Something isn't working labels Feb 17, 2022
@cwfitzgerald
Copy link
Member

This is also the case for at least GLES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help required We need community help to make this happen. type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants