IGuestSession_waitFor(Start) unexpectedly returns Terminate

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
rami
Posts: 10
Joined: 8. Jul 2012, 20:53

IGuestSession_waitFor(Start) unexpectedly returns Terminate

Post by rami »

Hi.

Host: Windows 10 64-bit
Oracle VM VirtualBox 6.1.14r140239
Guest: Windows Server 2016 x64 Datacenter
Guest Additions: 6.1.14r140239
Oracle VM VirtualBox web service Version 6.1.14
Connection type: Webservice
Language used: C# .NET

I've attached a Visual Studio 2017 solution that can reproduce the issue I'm facing.

Basically, I'm calling IGuestSession_waitFor(GuestSessionWaitResult.Start) to wait until the guest session has started, but that call unexpectedly returns GuestSessionWaitResult.Terminate.

High-level API calls to reproduce:
1. Create vboxPortTypeClient
2. Call IWebsessionManager_logon
3. Call IVirtualBox_findMachine
4. Call IWebsessionManager_getSessionObject
5. Call IMachine_lockMachine
6. Call ISession_getMachine
7. Call ISession_getConsole
8. Call IConsole_getGuest
9. Call IGuest_createSession
10. Call IGuestSession_waitFor <-- Fails here
11. Call IGuestSession_fileExists

Steps to reproduce:
1. Download and unzip attached file
2. Open VirtualBox.Tests.sln in Visual Studio 2017
3. Right-click on the Solution node in "Solution Explorer" and select "Restore NuGet Packages"
4. Run "generate classes from wsdls.cmd" to generate the VirtualBox web service proxy class
5. Open UnitTests.cs and change the following to your environment:

Code: Select all

     string virtualMachineNameOrId = "Windows Server 2016 x64 Datacenter";
     string username = "Administrator";
     string password = "password";
6. Run the following command in a non-elevated command prompt:
"c:\Program Files\Oracle\VirtualBox\VBoxWebSrv.exe" --verbose --timeout 0 --logfile vboxwebsrv.txt
7. Revert to a snapshot and power on the virtual machine
In my case, I created the snapshot about 14 days ago with the specified user account already logged in.
8. Right-click on "FileExistsInGuest" in "Test Explorer" and select "Run Selected Tests"
9. Notice the exception:
Exception: Guest session wait result: Terminate

As a work-around, I have to restart the guest OS in the virtual machine.

Any ideas?

Thank you.
Attachments
VirtualBox.Tests.zip
(137.03 KiB) Downloaded 65 times
rami
Posts: 10
Joined: 8. Jul 2012, 20:53

Re: IGuestSession_waitFor(Start) unexpectedly returns Terminate

Post by rami »

I discovered that a simpler work-around is to just restart the "VirtualBox Guest Additions Service" windows service (VBoxService) inside the guest OS / virtual machine.
Post Reply