-
Notifications
You must be signed in to change notification settings - Fork 618
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
Run in a new process group when not using --foreground #2574
Conversation
Example run (vz):
|
Example run (qemu):
|
Previously the hostagenet process was running in the foreground even when not using the --foreground option. It was using the same pgid of limactl process. If the guest was running, but limactl was interrupted the hostagent received the signal and was killed, stopping the VM. A simple way to fix this issue is to start the hostagent process in a new process group. This way it will be killed sending signals to the limactl process group. It looks like this is already implemented for Windows based on the docs for syscall.CREATE_NEW_PROCESS_GROUP[1]. Example run with this change: % ps -o pid,pgid,ppid,command PID PGID PPID COMMAND 39442 39442 39440 -zsh 63233 63233 39442 _output/bin/limactl start --vm-type vz --tty=false 63299 63299 63233 /Users/nsoffer/src/lima/_output/bin/limactl hostagent ... We can improve this later by adding an option to daemonize the hostagent process (like qemu --daemonize). [1] https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags Fixes lima-vm#2573 Signed-off-by: Nir Soffer <[email protected]>
With the fix[1] lima starts the hostagenet process in a new process group so we can run limactl normally as it should. When we terminate after errors limactl is terminated without harming the hostagenet process. [1] lima-vm/lima#2574 Signed-off-by: Nir Soffer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@AkihiroSuda thanks for merging quickly. Do you have an estimate when this fix will be available in a release? We can depend on local lima build via go install, but it will be easier to require a released version. |
Maybe around October? |
October would be fine, thanks! |
With the fix[1] lima starts the hostagenet process in a new process group so we can run limactl normally as it should. When we terminate after errors limactl is terminated without harming the hostagenet process. The fix is available in upstream but not released yet. It should available in lima around October. [1] lima-vm/lima#2574 Signed-off-by: Nir Soffer <[email protected]>
With the fix[1] lima starts the hostagenet process in a new process group so we can run limactl normally as it should. When we terminate after errors limactl is terminated without harming the hostagenet process. The fix is available in upstream but not released yet. It should available in lima around October. [1] lima-vm/lima#2574 Signed-off-by: Nir Soffer <[email protected]>
With the fix[1] lima starts the hostagenet process in a new process group so we can run limactl normally as it should. When we terminate after errors limactl is terminated without harming the hostagenet process. The fix is available in upstream but not released yet. It should available in lima around October. [1] lima-vm/lima#2574 Signed-off-by: Nir Soffer <[email protected]>
With the fix[1] lima starts the hostagenet process in a new process group so we can run limactl normally as it should. When we terminate after errors limactl is terminated without harming the hostagenet process. The fix is available in upstream but not released yet. It should available in lima around October. [1] lima-vm/lima#2574 Signed-off-by: Nir Soffer <[email protected]>
With the fix[1] lima starts the hostagenet process in a new process group so we can run limactl normally as it should. When we terminate after errors limactl is terminated without harming the hostagenet process. The fix is available in upstream but not released yet. It should available in lima around October. [1] lima-vm/lima#2574 Signed-off-by: Nir Soffer <[email protected]>
Similar to the how we run the hostagent process[1], we want to run the usernet process in the background. Now a program using killpg to cleanup child processes will not terminate the usernet process. Example run with this change: % ps -o pid,pgid,ppid,command PID PGID PPID COMMAND 55768 55768 55767 -zsh 56126 56126 55768 limactl start userv2.yaml --tty=0 56128 56128 56126 /Users/nsoffer/src/lima/_output/bin/limactl usernet ... 56131 56131 56126 /Users/nsoffer/src/lima/_output/bin/limactl hostagent ... % ps -o pid,pgid,ppid,command PID PGID PPID COMMAND 55768 55768 55767 -zsh 56128 56128 1 /Users/nsoffer/src/lima/_output/bin/limactl usernet ... 56131 56131 1 /Users/nsoffer/src/lima/_output/bin/limactl hostagent ... [1] lima-vm#2574 Signed-off-by: Nir Soffer <[email protected]>
Previously the hostagenet process was running in the foreground even when not using the --foreground option. It was using the same pgid of limactl process. If the guest was running, but limactl was interrupted the hostagent received the signal and was killed, stopping the VM.
A simple way to fix this issue is to start the hostagent process in a new process group. This way it will be killed sending signals to the limactl process group.
Example run with this change:
We can improve this later by adding an option to daemonize the hostagent process (like qemu --daemonize).
Fixes #2573