perfoon / Multirun

Godot plugin that allows to start multiple game instances at once.
MIT License
66 stars 13 forks source link

Zombie processes #2

Closed ncollie42 closed 3 years ago

ncollie42 commented 3 years ago

Zombie processes are being created every time a window is closed. This looks to be more of a godot thing, not reaping the child processes. This also only looks to happen when blocking is set to false.

We could work around this by killing them our self. Set the server process to blocking after starting the clients and kill all clients after server is terminated.

for i in range(window_count-1):
    commands = ["--position", str(50 + (i+1) * window_dist) + ",10"]
    if other_args && add_custom_args:
        for arg in other_args.split(" "):
            commands.push_front(arg)
    PIDS.append(OS.execute(OS.get_executable_path(), commands, false))

if first_args && add_custom_args:
        for arg in first_args.split(" "):
            commands.push_front(arg)
OS.execute(OS.get_executable_path(), commands, true)
for p in PIDS:
    OS.kill(p)

I'm ran this fedora, not sure about windows

perfoon commented 3 years ago

Thank you for finding this issue and providing the solution. I changed the overall behaviour of the plugin a bit. Now the first game instance is started in the Godot editor which makes the debugging easier but this means that it can't be blocking. Instead, I'm killing the processes when the multirun is started again or when the Godot editor is closed.