IGuestSession_waitFor(Start) unexpectedly returns Terminate

Discussion about using the VirtualBox API, Tutorials, Samples.

IGuestSession_waitFor(Start) unexpectedly returns Terminate

Postby rami » 25. Sep 2020, 23:22

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   Expand viewCollapse view
     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 12 times
rami
 
Posts: 4
Joined: 8. Jul 2012, 20:53

Re: IGuestSession_waitFor(Start) unexpectedly returns Terminate

Postby rami » 28. Jul 2021, 22:52

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.
rami
 
Posts: 4
Joined: 8. Jul 2012, 20:53


Return to The VirtualBox API

Who is online

Users browsing this forum: No registered users and 2 guests