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

windows: fix race condition with exception-based thread naming. #11257

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

slime73
Copy link
Contributor

@slime73 slime73 commented Oct 18, 2024

Description

#8849 changed the Windows thread naming code to always run the legacy RaiseException path. It also introduced an exception handler that's meant to stop that exception from being accidentally handled by outside code.

However the new exception handler continues execution for any exception that's raised in the brief time that the handler is active. The handler is activated briefly during thread setup. This ends up being a problem if, for example, the main thread starts a new thread and then immediately causes an exception that's meant to be properly handled instead of continued.

In practice in my app that uses LuaJIT it occasionally caused a panic error inside LuaJIT during my app's startup. Here's an example: https://github.com/love2d/love/actions/runs/11376760949/job/31650135750

To avoid the issue, this PR changes the thread name exception handler to only continue from the exception if the exception code is the thread name one. In other cases it hands things off to the next handler.

Existing Issue(s)

N/A

@slouken slouken merged commit 186c6e5 into libsdl-org:main Oct 18, 2024
38 checks passed
@slouken
Copy link
Collaborator

slouken commented Oct 18, 2024

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants