[vbox-dev] Virtualbox 4.3.2 - VM hosting processes crashes on VM shutdown

Magnus Madsen madsen.magnus at gmail.com
Wed Nov 6 09:22:48 GMT 2013


Dear Andreas,
I am not sure that my code is directly usable for reference as I am using
C# rather than CPP or Java which most referencing projects seem to be
programmed in.

I've just been testing some simple code, and to me it looks like there is
something that has broken more fundamentally in 4.3.2.

I keep getting exceptions (specifically  VERR_TIMEOUT) when doing simple
things using a IGuestSession that works with no issues with older versions
of the Guest Additions.


Testing now, I cannot get the VM hosting process to crash consistently with
my previously described technique - it seems to do it around 1/2 of the
time. Furthermore I was wrong about it being isolated to newer versions of
the Guest Additions - this also happens in a snapshot that is using a
pre-4.3 version of them.

I've tried to do several things with the Session, and what seems to cause
the exceptions most consistently is to move a lot of files to the VM. The
following code will for me crash 100% of the time:

// --------------------------------------------------
var Vbox = new VirtualBoxClass();
IMachine Machine = Vbox.FindMachine(MachineName);
Session Session = new Session();

Machine.LockMachine(Session, LockType.LockType_Shared);

IGuestSession GuestSession = Session.Console.Guest.CreateSession(Username,
Password, Domain, SessionName);

GuestSession.WaitFor((uint)GuestSessionWaitForFlag.GuestSessionWaitForFlag_Start,
2000);

for (int i = 0; i < 100; i++)
{
IProgress CopyP = GuestSession.CopyTo(SourceFile, destFile + i.ToString(),
new CopyFileFlag[] { CopyFileFlag.CopyFileFlag_None });

while (CopyP.Completed == 0)
Thread.Sleep(0);
}

//GuestSession.Close();

IProgress PowerDownP = Session.Console.PowerDown();
while (PowerDownP.Completed == 0)
Thread.Sleep(0);
// --------------------------------------------------

And if I uncomment the GuestSession.Close the code never crashes the
process. I am unfortunately not sure how C# handles the marshaller with
regards to setting the GuestSession to null and how that relates to the
issue. But specifically telling the marshaller to release the object (by
using Marshal.FinalReleaseComObject(GuestSession)) does not help with the
exception.

> Magnus,
>
> could you please send me the code snippets of your IGuestSession /
> IConsole / ISession objects, especially with regarding to object
> lifetime (scoping).
>
> Is IGuestSession a (static) global, and does it get properly NULLed (via
> "= NULL" and/or .setNull()) before calling com::Shutdown() ?
>
> Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20131106/74de4bbc/attachment.html>


More information about the vbox-dev mailing list