[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vbox-dev
Subject:    Re: [vbox-dev] Virtualbox 4.3.2 - VM hosting processes crashes on VM shutdown
From:       Magnus Madsen <madsen.magnus () gmail ! com>
Date:       2013-11-06 9:22:48
Message-ID: CA+V-7mRa-W1AswUp9+VRMqSFen_HScBkeyr=1SSvB1gPJBcoCQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

[Attachment #5 (text/html)]

<div dir="ltr"><div>Dear Andreas,<br></div><div>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.</div><div><br></div>

<div>I&#39;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.</div><div><br></div><div>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.</div> <div><br></div><div><br></div><div>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.</div> <div><br></div><div>I&#39;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:</div> <div><br></div><div>// \
--------------------------------------------------</div><div>            var Vbox = \
new VirtualBoxClass();<br>            IMachine Machine = \
Vbox.FindMachine(MachineName);<br>            Session Session = new Session();<br> \
<br>            Machine.LockMachine(Session, LockType.LockType_Shared);<br><br>       \
IGuestSession GuestSession = Session.Console.Guest.CreateSession(Username, Password, \
Domain, SessionName);<br><br>            \
GuestSession.WaitFor((uint)GuestSessionWaitForFlag.GuestSessionWaitForFlag_Start, \
2000);<br> <br>            for (int i = 0; i &lt; 100; i++)<br>            {<br>      \
IProgress CopyP = GuestSession.CopyTo(SourceFile, destFile + i.ToString(), new \
CopyFileFlag[] { CopyFileFlag.CopyFileFlag_None });<br><br>  while (CopyP.Completed \
== 0)<br>                    Thread.Sleep(0);<br>            }<br><br>            \
//GuestSession.Close();<br><br>            IProgress PowerDownP = \
Session.Console.PowerDown();<br>            while (PowerDownP.Completed == 0)<br>  \
Thread.Sleep(0);<br></div><div> // --------------------------------------------------
<br></div><div><br></div><div>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.</div> \
<div><br></div>&gt; Magnus,<br>&gt;<br>&gt; could you please send me the code \
snippets of your IGuestSession / <br> &gt; IConsole / ISession objects, especially \
with regarding to object <br>&gt; lifetime (scoping).<br>&gt; <br>&gt; Is \
IGuestSession a (static) global, and does it get properly NULLed (via <br>&gt; \
&quot;= NULL&quot; and/or .setNull()) before calling com::Shutdown() ?<br>

&gt; <br>&gt; Andreas</div>



_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic