VBox GUI hangs after power up the VM.

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
siuks24
Posts: 12
Joined: 28. Mar 2019, 18:04

VBox GUI hangs after power up the VM.

Post by siuks24 »

Hi,
Is possible to use VBox GUI and other application using VBox API in the same time? When I run a virtual machine using IConsole::PowerUp(), virtual machine works correctly but GUI of VBox hangs. GUI works OK until I execute the line " console->PowerUp(&progress);". Is it the expected behavior or had I done something wrong? I'v not found any information which mentioned that start of VM(via IConsole::StartUp) causes hang of VBox GUI.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VBox GUI hangs after power up the VM.

Post by socratis »

siuks24 wrote:Is possible to use VBox GUI and other application using VBox API in the same time?
Absolutely! You can use VBoxManage commands while the Manager is running, and any changes you do in the CLI will be reflected in the GUI. So, yes, it does work.

Unfortunately I don't know enough on the programming/API level to help you any further. Perhaps a visit on the IRC channel (#vbox-dev) might help you...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VBox GUI hangs after power up the VM.

Post by noteirak »

VM sessions are designed around locks. When you create a session in the API, which allows you to access the console per example, you give a lock type. If you use an exclusive lock, then yes you will block any other process to access the VM.
If you directly use the IConsole object, then you consider yourself the process owner of the VM while its running, which will block the GUI to perform some tasks indeed.

If you do not want to be a process owner but replicate what the GUI does, starting a VM should be done using IMachine::launchVMProcess which properly handling locking.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
siuks24
Posts: 12
Joined: 28. Mar 2019, 18:04

Re: VBox GUI hangs after power up the VM.

Post by siuks24 »

Thanks noteirak. I have to be a process owner because I need to attach my own frame buffer to VM. I understand that if I run eg Machine1 then that machine is unavailable from GUI, but what with other machines? what if I would like to run two different machines: the first one via my app , the second one via GUI? Right now when I start virtual machine via my app whole GUI hang(I get message that window isn't responding) and I can do nothing. I'm trying to resolve this problem but I don't know if it cause by my mistake or if it's expected behavior of VBox. Do you know something about it?
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VBox GUI hangs after power up the VM.

Post by noteirak »

I never went into that specific of the source code, but basically you need to perform specific steps when it comes to being the process owner. There is a third lock type which can be used for that specific purpose and will allow to keep a "master" lock and then allow other processes to have other kind of locks. My advise is to check the VBoxManage code and the VBoxHeadless to see how that lock dance is done. You would simply want to replicate the same I believe.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply