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

tcli run orphans game processes upon termination #84

Open
krujroom opened this issue Apr 15, 2023 · 2 comments
Open

tcli run orphans game processes upon termination #84

krujroom opened this issue Apr 15, 2023 · 2 comments

Comments

@krujroom
Copy link

krujroom commented Apr 15, 2023

After staring a game with tcli run, the tcli process will orphan the game process upon termination.

Expected Behavior

After running a game with tcli run, terminating the tcli process (e.g. Ctrl+C, SIGTERM/SIGKILL) should also terminate the game process.

Current Behavior

The game process remains running as an orphan process after the tcli run process is terminated.

Steps to Reproduce

  1. Start a managed game with tcli e.g. tcli.exe run {game identifier}
  2. Verify both the tcli and game process are running:
$ ps o pid,ppid,pgid,sid,start,time,cmd --forest
   PID    PPID    PGID    SID  STARTED     TIME CMD
142557  142556  142557  142557 00:17:29 00:00:00 -bash
142913  142557  142913  142557 00:34:16 00:00:00  \_ tcli run -- -name ModdedTest ..
142929  142913  142913  142557 00:34:17 00:00:02      \_ /home/valheim/valheim/server/valheim_server.x86_64 -name ModdedTest ...
  1. Terminate the tcli process (e.g. pressing Ctrl+C in a shell or sending SIGTERM/SIGKILL with kill)
  2. Verify the tcli process is terminated, but the game process is running and orphaned:
$ ps o pid,ppid,pgid,sid,start,time,cmd --forest
    PID    PPID    PGID     SID  STARTED     TIME CMD
 142929       1  142913  142557 00:34:17 00:02:45 /home/valheim/valheim/server/valheim_server.x86_64 -name ModdedTest ...

Workaround

Manually terminate the game process with kill e.g. kill 142929 in example above.

Context (Environment)

Running tcli 0.2.0 with tcli-bepinex-installer 0.1.0 (compiled with an older glibc version) on Debian GNU/Linux 11 (bullseye)

@krujroom krujroom changed the title tcli run orphans game process upon termination tcli run orphans game processes upon termination Apr 15, 2023
@Windows10CE
Copy link
Member

Not much can be done for SIGKILL, but for SIGTERM I can certainly have it try to terminate the game process as well, at least for games not launched through Steam (since I don't have direct control over those).

I vaguely remember ctrl-c working to kill the game process on my system? Could've just been my imagination, but I'll look into it nonetheless.

@MythicManiac
Copy link
Member

MythicManiac commented Apr 16, 2023

Perhaps we could also support a pidfile of some kind, making it easier to clean up externally?

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

No branches or pull requests

3 participants