-
Notifications
You must be signed in to change notification settings - Fork 10
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
xtask: sugondat-node zombie process #228
Comments
This is a highly non-trivial task actually. At least in theory. In Linux, when a process dies all its children usually reparented to PID1 ( It is possible to sign up for a signal when the parent dies (using There is PR_SET_CHILD_SUBREAPER that designates a process to receive orphans (due to reparenting). I am not aware if there is a notification to the parent process about that happening, so not sure how to make the parent to react. Also, the elephant in the room, is that the options above obviously won't work for macOS. Well, to clarify, I don't mean that it's a futile goal, after all all programs having a similar functionality probably don't bother too much, and there are cases when orphans get created. |
Interesting. This is a lot trickier than I expected it to be. Here's another take on the problem: https://github.com/oconnor663/duct.py/blob/master/gotchas.md#killing-grandchild-processes. A possible solution could be to implement a new xtask's task that will be executed by duct, spawning a new process instead of calling What do you think? This should be discussed before implementation because my gut feeling is that it may not be straightforward |
The problem with orphans here is that we need to manually kill all processes between each 'cargo xtask test.' Otherwise, the shim would find and immediately ready sugondat-node, which would break all the testing |
I also did some research and also concluded that
When you create a child process, the pgid is inhereted by default. You don't have to call
For that, it would be better not to inherit the pgid, but assign a new process group to zombienet. This way xtask would be able to kill only the zombienet and its children, but xtask won't kill itself. In this case, however, relevant signals sent to xtask should be caught and forwarded to the children. Otherwise, the shell will send e.g. ^C to the pg of xtask and not the zombienet's.
Sure, although to clarify, not between, but rather at the end. We should not try to be smart and start killing processed which we detect to be leftovers. |
yess! I was saying the same thing, I just express myself really badly!
uhh, I didn't think about it!! yes, it must be done otherwise we would solve a problem and create another |
you previously were confused, why I would bring up tokio, so the reason is, Signal handling is pretty complicated. Listening for signals is pretty anoying and complicated and then delivering those signals to the required place in the program is also annoying. Using the async approach simplifies it and tokio offers |
The Zombienet process does not seem to kill the Sugondat-node spawned process. Usually, when we press Ctrl+C on the Zombienet executed in the terminal, all grandchild processes are killed (by the shell I think). However, Duct behaves differently and "does not kill any grandchild processes that the children have spawned on their own." Since Zombienet apparently does nothing on its own, we need to either keep track of the 'sugondat-node' process or request Zombienet to do that for us
The text was updated successfully, but these errors were encountered: