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

Fixes for random lockups on start with Proton #688

Merged
merged 2 commits into from
Mar 25, 2023
Merged

Conversation

gofman
Copy link
Contributor

@gofman gofman commented Mar 24, 2023

RE4 now randomly lockups on start under Wine / Proton with REFramework.

The first reason for that (fixed by the first patch) is that when threads are suspended that may happen while they are holding loader lock (due to, e. g., loading or process / thread attaching dlls, i. e., being inside DllMain). That doesn't immediately lock up on Windows as on modern windows GetModuleHandle() and some other queries do not take loader lock but still do so on Wine. Some other cases also take a loader lock though and block while suspended threads hold it, like LoadLibrary, or any newly created thread will block on loader lock before calling DllMain. So it is maybe best to make sure the threads being suspended don't hold loader lock on Windows as well.

The other lockup (fixed by second patch) which is also randomly reproduced is trickier but also related to suspending threads in unfortunate moments (and then creating a new thread locks the creating thread). This is an internal Wine bug which is hard to fix though, but at the same time fix for it in REFramework seems much more straightforward: it is probably no reason to keep the threads suspended until the constructor ends as this suspend doesn't even happen in a generic case (not invoving re4 and re8) and the rest of the constructor works without threads suspension anyway.

@praydog praydog merged commit 7088ddb into praydog:master Mar 25, 2023
@praydog
Copy link
Owner

praydog commented Mar 25, 2023

Thanks

dtlnor pushed a commit to dtlnor/REFramework that referenced this pull request Sep 12, 2024
* Make sure suspended threads do not hold loader lock in REFramework::REFramework()

* Resume threads earlier in REFramework::REFramework()

---------

Co-authored-by: Paul Gofman <[email protected]>
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