lutris / agora

Public discussion space for the community
11 stars 0 forks source link

lutris-wrapper kills irrelevant shell processes started by child #23

Open AaronOpfer opened 5 years ago

AaronOpfer commented 5 years ago

If a game launched by lutris-wrapper uses xdg-open to show a file or URL, lutris-wrapper's will view the executable used to open that file or URL as one of the game's executables and will kill it when "Stop" is pressed. For example Lutris killed my web browser after a game opened a URL and then I pressed "Stop" in Lutris, even though I had long since navigated away from that URL and opened several other tabs.

I think we should find some way to make xdg-open commands ran by monitored processes leave the process tree, perhaps by replacing PATH. It would be a pretty big hack but it might prevent lost data.

strycore commented 5 years ago

what game does that?

AaronOpfer commented 5 years ago

It's mostly wine games' launchers. For instance the EVE Online launcher has several news items on the launcher that open URLs when clicked, which are opened in the user's browser. I think it should be argued that the user's browser should be considered a part of their shell and not a part of the game, but lutris will believe otherwise. If the browser wasn't open previously, then the new browser process will remain open and be considered a part of the game's process tree.

If this explanation still isn't clear I think I can make a demo windows EXE showing the problem.

On Tue, Mar 19, 2019, 4:35 AM Mathieu Comandon notifications@github.com wrote:

what game does that?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lutris/lutris/issues/1860#issuecomment-474090090, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIk4TsrfVZl-FKKEHW4v26HkCi5VjJdks5vX_h-gaJpZM4b3hKv .

strycore commented 5 years ago

No, that's clear, I can reproduce that with Battlefield 3 quite easily!

I'm reading this: https://unix.stackexchange.com/questions/152379/is-reparenting-from-the-shell-possible and wondering if it would be possible to re-parent each xdg-open (or equivalent) process to PID 1, I'm seeing a mention of PR_SET_CHILD_SUBREAPER in the response so this seem somewhat related to something we already have.

AaronOpfer commented 5 years ago

I think the answer is to somehow intercept xdg-open execs made by child processes (PATH hacks?) and run them in lutris instead (not lutris-wrapper but one level above), probably by using a named socket or an anonymous inherited socket. Since GTK has an event API for files and sockets that we already use to monitor stdout, we can add this feature without adding a thread to lutris.

On Tue, Mar 19, 2019, 1:05 PM Mathieu Comandon notifications@github.com wrote:

No, that's clear, I can reproduce that with Battlefield 3 quite easily!

I'm reading this: https://unix.stackexchange.com/questions/152379/is-reparenting-from-the-shell-possible and wondering if it would be possible to re-parent each xdg-open (or equivalent) process to PID 1, I'm seeing a mention of PR_SET_CHILD_SUBREAPER in the response so this seem somewhat related to something we already have.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lutris/lutris/issues/1860#issuecomment-474199908, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIk4azHJ-IH-J5fQh0KxLRYAEcES_C8ks5vYHAsgaJpZM4b3hKv .