Open beh-10257 opened 1 year ago
Can reproduce on sway as well. IMO gamescope should wait for all windows inside it to close before closing itself.
bumping
Gamescope does try to kill its children when it dies but if you are forcing that it's likely not getting a chance.
I don't think that it's forcing. I'm pretty sure that it's the equivalent of pressing the "x" button to close a window. For example, doing the same on a LibreOffice Writer window still allows it to prompt the user on whether to save the document or not.
I think this might actually be issue with children that double fork
Hmm, I tried make gamescope call my reaper
binary from here https://github.com/Cloudef/pid-defer
And the reaper indeed does not seem to receive any sigterm from gamescope.
Wonder if wlroots/hyprland is being too agressive in closing the process, or gamescope does not handle wayland disconnect properly? Here are some logs from the end:
(EE) failed to read Wayland events: Broken pipe
X connection to :1 broken (explicit kill or server shutdown).
X connection to :1 broken (explicit kill or server shutdown).
X connection to :1 broken (explicit kill or server shutdown).
X connection to :1 broken (explicit kill or server shutdown).
X connection to :1 broken (explicit kill or server shutdown).
Currently I have to do some manual cleanup https://github.com/Cloudef/nixos-flake/blob/master/modules/steamdeck-experience.nix#L197 https://github.com/Cloudef/nixos-flake/blob/master/modules/steamdeck-experience.nix#L231-L235
EDIT: with more simple scenario with launching zenity it works. I'll see if I can make something easily reproducible.
@Joshua-Ashton
Gamescope does try to kill its children when it dies but if you are forcing that it's likely not getting a chance.
Since gamescope uses sdl2’s event system, I wondered if sdl2 could be causing this issue (wherein gamescope runs SDL_Init( SDL_INIT_VIDEO | SDL_INIT_EVENTS )
this issue would only be seen in nested mode)
I found a stackoverflow post from 2013 that says that sdl2 (when initialized with SDL_INIT_EVENTS
) registers its own signal handler that causes the process (in this case the gamescope process) to abort when it receives SIGINT or SIGTERM: (w/ SIGTERM being the signal for requesting an application to close)
https://stackoverflow.com/questions/20049025/cant-ctrl-c-my-sdl-apps-anymore#20171501
ofc this is from 2013, not sure if sdl2 still does this
EDIT: I just realized there’s also an SDL2 wiki page mentioning this: https://wiki.libsdl.org/SDL2/SDL_HINT_NO_SIGNAL_HANDLERS
w/ SIGTERM being the signal for requesting an application to close
Are you sure? I've just tried to send SIGTERM to a LibreOffice Writer window and it just closed immediately without prompting to save the document (unlike when I close it via Sway).
w/ SIGTERM being the signal for requesting an application to close
Are you sure? I've just tried to send SIGTERM to a LibreOffice Writer window and it just closed immediately without prompting to save the document (unlike when I close it via Sway).
programs are able to ignore SIGTERM signals, but not SIGKILL signals https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html
w/ SIGTERM being the signal for requesting an application to close
Are you sure? I've just tried to send SIGTERM to a LibreOffice Writer window and it just closed immediately without prompting to save the document (unlike when I close it via Sway).
programs are able to ignore SIGTERM signals, but not SIGKILL signals gnu.org/software/libc/manual/html_node/Termination-Signals.html
Sorry I think I misunderstood what you had said earlier. I just meant that SIGTERM is not what's used for an application's window to close.
I feel like the solution to this issue would be for gamescope to forward the window close event to all windows inside it and stay open until those windows close, rather than just immediately closing the gamescope window and trying to stop the processes in some other way (like SIGTERM).
in my system to exit any application I just use SUPER+C the default for Hyprland anyway so basically after pressing that key combination while running apex legends and after checking in htop we can see that gamescope actually closes but all his child processes don't aka the game so yeah I guess the expected behaviour is to gamescope to kill his child processes