BeamMP-Launcher icon indicating copy to clipboard operation
BeamMP-Launcher copied to clipboard

proton download loop workaround

Open Kethen opened this issue 1 year ago • 3 comments

This PR is provided as a reference to the 99.9% stuck issue on proton, as SesbianLex42069 (snarky-ly) pointed out that it is possible for the download to get stuck indefinitely at https://forum.beammp.com/t/linux-setup-beammp-proton-with-steamtinkerlaunch/688297/27, as well as https://discord.com/channels/601558901657305098/1244002666384986112/1244002666384986112

Stopping the async update thread explicitly to avoid it getting stuck due to ~~floating point conversion quirks~~ race condition on incrementing GRcv

Not sure how useful this will still be after the big launcher rewrite that is going on, just leaving this here as a reference

Tested working inside proton after helping the launcher find the game install with regedit, I can download mods during server joining without getting stuck at 99.9% with this change

Kethen avatar May 26 '24 09:05 Kethen

Oh my god why do we even have floating point stuff in there, I'm going to scream. Thank you, I'll look into this.

lionkor avatar May 26 '24 09:05 lionkor

Actually it’s likely race condition on GRcv’s increment instead of floating point quirk

Kethen avatar May 26 '24 12:05 Kethen

I'm not sure I can reproduce the issue, actually!

lionkor avatar Jul 16 '24 14:07 lionkor

It might have to do with differences in wine's vcruntime*.dll and msvcrt.dll compared to windows, or linux itself, having slight difference when it comes to incrementing a non atomic variable on two different threads without any use of mutex

I'm rather surprised by how no one had the same issue on windows, since it happens a lot in wine with moderately sized files, and writing a non atomic variable on two threads without locks requires compilers to increment variables atomically by default

Kethen avatar Aug 19 '24 23:08 Kethen

aka its undefined behavior and its a data race, yeah. I don't know why it was written like this.

lionkor avatar Aug 22 '24 01:08 lionkor

This should be fixed since we've now just gotten rid of the other thread entirely, that was stupid design. Thank you for your contribution, it pointed out some bigger issues!

lionkor avatar Sep 28 '24 20:09 lionkor