-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
example/gui-linux does not exit when vm.Stop()
is used
#150
Comments
The GUI code in virtualization_view.m is notified when there was a guest initiated shutdown ('guestDidStopVirtualMachine') and when there was a virtualization error ('didStopWithError'). When calling Stop(), the VM is forcefully stopped (similar to pulling the plug on real hardware). This action is neither a guest initiated shutdown, nor a virtualization error, so the GUI code does not catch it. This means after calling vm.Stop(), the GUI main loop will keep running, and the application using Code-Hex/vz will never exit. This commit fixes this by adding an observer for VM state changes, and by calling 'terminate' when the VM state becomes 'stopped' or 'error'. This fixes Code-Hex#150
The GUI code in virtualization_view.m is notified when there was a guest initiated shutdown ('guestDidStopVirtualMachine') and when there was a virtualization error ('didStopWithError'). When calling Stop(), the VM is forcefully stopped (similar to pulling the plug on real hardware). This action is neither a guest initiated shutdown, nor a virtualization error, so the GUI code does not catch it. This means after calling vm.Stop(), the GUI main loop will keep running, and the application using Code-Hex/vz will never exit. This commit fixes this by adding an observer for VM state changes, and by calling 'terminate' when the VM state becomes 'stopped' or 'error'. This fixes Code-Hex#150
The GUI code in virtualization_view.m is notified when there was a guest initiated shutdown ('guestDidStopVirtualMachine') and when there was a virtualization error ('didStopWithError'). When calling Stop(), the VM is forcefully stopped (similar to pulling the plug on real hardware). This action is neither a guest initiated shutdown, nor a virtualization error, so the GUI code does not catch it. This means after calling vm.Stop(), the GUI main loop will keep running, and the application using Code-Hex/vz will never exit. This commit fixes this by adding an observer for VM state changes, and by calling 'terminate' when the VM state becomes 'stopped' or 'error'. This fixes Code-Hex#150
@cfergeau Sorry, what was the problem with this issue? |
The GUI code in virtualization_view.m is notified when there was a guest initiated shutdown ('guestDidStopVirtualMachine') and when there was a virtualization error ('didStopWithError'). When calling Stop(), the VM is forcefully stopped (similar to pulling the plug on real hardware). This action is neither a guest initiated shutdown, nor a virtualization error, so the GUI code does not catch it. This means after calling vm.Stop(), the GUI main loop will keep running, and the application using Code-Hex/vz will never exit. This commit fixes this by adding an observer for VM state changes, and by calling 'terminate' when the VM state becomes 'stopped' or 'error'. This fixes Code-Hex#150
Yes, calling |
@cfergeau Thank you for your explanation. I'll fix it in the PR I'm currently opening.
|
@cfergeau Could you check this comment please 🙏 |
Describe the bug
The GUI code in virtualization_view.m is notified when there was a guest initiated shutdown ('guestDidStopVirtualMachine') and when there was a virtualization error ('didStopWithError').
When calling Stop(), the VM is forcefully stopped (similar to pulling the plug on real hardware). This action is neither a guest initiated shutdown, nor a virtualization error, so the GUI code does not catch it. This means after calling vm.Stop(), the GUI main loop will keep running, and the application using Code-Hex/vz will never exit.
The branch https://github.com/cfergeau/vz/tree/hardstop-gui has a fix for this bug. It adds an observer for VM state changes, and calls 'terminate' when the VM state becomes 'stopped' or 'error'.
I can file a PR if this approach is acceptable to you, or I can explore a different fix if needed.
This was initially reported as crc-org/vfkit#67
To Reproduce
Steps to reproduce the behavior:
(this change is made in my branch https://github.com/cfergeau/vz/tree/hardstop-gui)
Expected behavior
The process stops after 10 seconds.
Environment that you use to compile (please complete the following information):
sw_vers | pbcopy
]uname -m | pbcopy
]arm64
go version | pbcopy
]go version go1.20.5 darwin/arm64
The text was updated successfully, but these errors were encountered: