Page 1 of 1

VBox GUI hangs after power up the VM.

PostPosted: 9. Jul 2019, 13:57
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.

Re: VBox GUI hangs after power up the VM.

PostPosted: 10. Jul 2019, 09:20
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...

Re: VBox GUI hangs after power up the VM.

PostPosted: 11. Jul 2019, 14:15
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.

Re: VBox GUI hangs after power up the VM.

PostPosted: 11. Jul 2019, 15:55
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?

Re: VBox GUI hangs after power up the VM.

PostPosted: 11. Jul 2019, 15:58
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.