-
Notifications
You must be signed in to change notification settings - Fork 201
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
Fix issues that caused gamescope to abort at exit #1335
base: master
Are you sure you want to change the base?
Conversation
6d4eb11
to
41000c4
Compare
…g gamescope, due to a race condition between present thread @ present_wait_thread_func & compositor thread @ steamcompmgr_exit
41000c4
to
61392a9
Compare
Last Update: for some reason, the present thread needs to run |
just as a heads up @sharkautarch this PR causes both a gamescope and an xwayland coredump once the "Switch to Desktop" shortcut is used within gamescope-session on my 7900XTX on Fedora 40. this results in a 20-40 second freeze before the session switch executes properly and returns me to desktop. gamescope-coredump.log edit: also, the same issue happens when applied against upstream gamescope master so you can disregard the gamescope-plus logging in gamescope-stdout |
@matte-schwartz Then, try running gamescope with these environment variables to run w/ address sanitizer: Note that when running w/ address sanitizer, coredumping is disabled, because otherwise the coredumps would be terabytes in size… I’m not sure if you might need to actually recompile gamescope w/ address sanitizer instrumentation in order to catch whatever issue is going on… |
I gave this a try but keep getting an error about needing to link asan at runtime, even though I built gamescope following your instructions below. Let me read up a bit on how these tools are supposed to work so I can try and figure out what's going wrong.
|
@matte-schwartz If so, try running ASAN again, but this time with the |
The first commit fixes issue #1305
Note: I used a user event instead of the sdl quit event, to ensure that the sdl thread is only closed from inside
steamcompmgr_exit()
After fixing the aforementioned issue, I noticed that gamescope would still sometimes abort/coredump at exit.
So I found a separate issue, wherein the present_wait thread, when running
GetVBlankTimer().MarkVBlank( vblanktime, true );
, would segfault upon trying to access a backend whilesteamcompmgr_exit()
was deleting said backend.The second commit fixes this w/ an awkward dance between the two threads, where
steamcompmgr_exit()
asks the present_wait thread to exit, and then waits for the present_wait thread to respond back.The reason why I did that weird stuff in the second commit is that I wanted to minimize the overhead being added to
present_wait_thread_func()
: for most of the runtime, this commit will not add any delay topresent_wait_thread_func()
update: Slight edit to the second commit: in
steamcompmgr_exit()
, I moved the atomic store tog_presentThreadShouldExit
so that it happens before the atomic store tog_currentPresentWaitId
, just to cover any rare edge case w/ atomic load/store timing