Conversation
|
Does the same happen with the shell init? (--no-virtme-ng-init) |
No, that one seems to work all right. It seems clippy is not happy if we don't call |
|
Is |
Well, I find it useful. In places where I just clone virtme-ng, I can start a VM without having cargo/rust around. For most cases, maybe people will use the packaged version, but at least for me, the recent fixes are important for my workloads. |
|
The Bash version is also easier to hack to quickly try things, and it doesn't have some optimisations done in the Rust version which could cause some issues. Also, please note that some packages still don't contain |
If the users create ofphaned processes, it's init's task to
reap them or else they'll remain as zombies.
For example:
vng --user root
_ _
__ _(_)_ __| |_ _ __ ___ ___ _ __ __ _
\ \ / / | __| __| _ _ \ / _ \_____| _ \ / _ |
\ V /| | | | |_| | | | | | __/_____| | | | (_| |
\_/ |_|_| \__|_| |_| |_|\___| |_| |_|\__ |
|___/
kernel version: 6.19.0-virtme x86_64
(CTRL+d to exit)
bash-5.3# (setsid sleep 1 &); sleep 2; ps aux | grep 'sleep'
root 342 0.0 0.0 0 0 ? Zs 18:11 0:00 [sleep] <defunct>
root 345 0.0 0.0 3464 1932 ttyS0 S+ 18:11 0:00 grep 'sleep'
bash-5.3#
Replace the specific waitpid (internal to `Command::output()`) with a
simple loop that will also reap zombies if they appear.
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
|
Since there is a workaround, this is not a big issue for me anymore. Feel free to close the PR. If you would like this issue to be solved in the rust init in any other way, let me know and I'll give it a try. |
|
I think it is fine to ignore the clippy warning, but I'm not a rust expert. @arighi WDYT? |
The bash init is definitely going to stay. We can't cross-compile |
Nit: "ofphaned" -> "orphaned" |
|
|
||
| fn wait_for_child(child: i32) { | ||
| loop { | ||
| match wait() { |
There was a problem hiding this comment.
wait() can fail with EINTR when the process receives a signal. Right now any error leads to a log + return, so the direct child is never reaped and can stay a zombie. Maybe add:
Err(Errno::EINTR) => continue,
| .output() | ||
| .spawn() | ||
| .expect("Failed to start shell session"); | ||
| wait_for_child(child.id() as i32); |
There was a problem hiding this comment.
Maybe we should apply the same spawn/wait pattern to run_user_script() as well?
I think it's correct to ignore: the warning is because we spawned a child without waiting on it, but we do wait (via a custom wait() loop), so it's just lint that doesn't understand this pattern. |
|
BTW, I'm not able to reproduce this problem, I don't see any zombie tasks. Did it go away with some of the recent changes? |
I can still reproduce it on my side: (also without As @amorenoz said before, this issue is only with vng-init, not with the bash init script. How did you try? |
@matttbe Ah yes, with this I can reproduce it. Ok, then we should fix this and once we land this one we can cut a new version, wdyt? |
Good idea to cut a new version! Do you mean you are planning to apply the suggestions you sent here? |
Yeah we need to resolve the conflicts and include my comments, if @amorenoz doesn't have time maybe I can add these changes on top of this commit. |
If the users create ofphaned processes, it's init's task to reap them or else they'll remain as zombies.
For example:
Replace the specific waitpid (internal to
Command::output()) with a simple loop that will also reap zombies if they appear.