<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>digged some more.</DIV>
<DIV> </DIV>
<DIV>The freeze is caused by the following wait function (in red):</DIV>
<DIV> </DIV>
<DIV>vmm\ssm.cpp</DIV>
<DIV> </DIV><FONT color=#008000 size=2><FONT color=#008000 size=2>
<DIV>/**</DIV>
<DIV>* The I/O thread.</DIV>
<DIV>*</DIV>
<DIV>* @returns VINF_SUCCESS (ignored).</DIV>
<DIV>* @param hSelf The thread handle.</DIV>
<DIV>* @param pvStrm The stream handle.</DIV>
<DIV>*/</DIV></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<DIV>static</FONT></FONT><FONT size=2> DECLCALLBACK(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2>) ssmR3StrmIoThread(RTTHREAD hSelf, </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> *pvStrm)</DIV>
<DIV>{</DIV>
<DIV>PSSMSTRM pStrm = (PSSMSTRM)pvStrm;</DIV>
<DIV>ASMAtomicWriteHandle(&pStrm->hIoThread, hSelf); </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>/* paranoia */</DIV></FONT></FONT><FONT size=2>
<DIV>Log((</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"ssmR3StrmIoThread: starts working\n"</FONT></FONT><FONT size=2>));</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (pStrm->fWrite)</DIV>
<DIV>{</DIV>
<DIV></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>/*</DIV>
<DIV>* Write until error or terminated.</DIV>
<DIV>*/</DIV></FONT></FONT><FONT size=2>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>for</FONT></FONT><FONT size=2> (;;)</DIV>
<DIV>{</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> rc = ssmR3StrmWriteBuffers(pStrm);</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> ( RT_FAILURE(rc)</DIV>
<DIV>|| rc == VINF_EOF)</DIV>
<DIV>{</DIV>
<DIV>Log((</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"ssmR3StrmIoThread: quitting writing with rc=%Rrc.\n"</FONT></FONT><FONT size=2>, rc));</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>break</FONT></FONT><FONT size=2>;</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (RT_FAILURE(pStrm->rc))</DIV>
<DIV>{</DIV>
<DIV>Log((</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"ssmR3StrmIoThread: quitting writing with stream rc=%Rrc\n"</FONT></FONT><FONT size=2>, pStrm->rc));</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>break</FONT></FONT><FONT size=2>;</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (ASMAtomicReadBool(&pStrm->fTerminating))</DIV>
<DIV>{</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (!ASMAtomicReadPtrT(&pStrm->pHead, PSSMSTRMBUF))</DIV>
<DIV>{</DIV>
<DIV>Log((</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"ssmR3StrmIoThread: quitting writing because of pending termination.\n"</FONT></FONT><FONT size=2>));</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>break</FONT></FONT><FONT size=2>;</DIV>
<DIV>}</DIV>
<DIV>Log((</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"ssmR3StrmIoThread: postponing termination because of pending buffers.\n"</FONT></FONT><FONT size=2>));</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>else</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (!ASMAtomicReadPtrT(&pStrm->pHead, PSSMSTRMBUF))</DIV>
<DIV>{</DIV>
<DIV><FONT color=#ff007f>rc = RTSemEventWait(pStrm->hEvtHead, RT_INDEFINITE_WAIT);  <=== stuck here</FONT></DIV>
<DIV>AssertLogRelRC(rc);</DIV>
<DIV>}</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (!ASMAtomicReadBool(&pStrm->fTerminating))</DIV>
<DIV>RTSemEventSignal(pStrm->hEvtFree);</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>else</DIV></FONT></FONT><FONT size=2>
<DIV>{</DIV>
<DIV></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>/*</DIV>
<DIV>* Read until end of file, error or termination.</DIV>
<DIV>*/</DIV></FONT></FONT><FONT size=2>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>for</FONT></FONT><FONT size=2> (;;)</DIV>
<DIV>{</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (ASMAtomicReadBool(&pStrm->fTerminating))</DIV>
<DIV>{</DIV>
<DIV>Log((</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"ssmR3StrmIoThread: quitting reading because of pending termination.\n"</FONT></FONT><FONT size=2>));</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>break</FONT></FONT><FONT size=2>;</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> rc = ssmR3StrmReadMore(pStrm);</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> ( RT_FAILURE(rc)</DIV>
<DIV>|| rc == VINF_EOF)</DIV>
<DIV>{</DIV>
<DIV>Log((</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"ssmR3StrmIoThread: quitting reading with rc=%Rrc\n"</FONT></FONT><FONT size=2>, rc));</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>break</FONT></FONT><FONT size=2>;</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (RT_FAILURE(pStrm->rc))</DIV>
<DIV>{</DIV>
<DIV>Log((</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"ssmR3StrmIoThread: quitting reading with stream rc=%Rrc\n"</FONT></FONT><FONT size=2>, pStrm->rc));</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>break</FONT></FONT><FONT size=2>;</DIV>
<DIV>}</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (!ASMAtomicReadBool(&pStrm->fTerminating))</DIV>
<DIV>RTSemEventSignal(pStrm->hEvtHead);</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> VINF_SUCCESS;</DIV>
<DIV>}</DIV>
<DIV></FONT><BR><BR>--- On <B>Mon, 8/9/10, Huihong Luo <I><huisinro@yahoo.com></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Huihong Luo <huisinro@yahoo.com><BR>Subject: Re: [vbox-dev] savestate still hangs sometimes (reported before)<BR>To: "Huihong Luo" <huisinro@yahoo.com><BR>Cc: "vbox-dev@virtualbox.org" <vbox-dev@virtualbox.org><BR>Date: Monday, August 9, 2010, 7:40 PM<BR><BR>
<DIV id=yiv1515176730>
<DIV>This change causes serious side effects, </DIV>
<DIV>pls ignore it. Switching display mode won't work well.<SPAN class=yiv1515176730Apple-style-span> </SPAN></DIV>
<DIV><BR>Sent from my iPhone</DIV>
<DIV><BR>On Aug 9, 2010, at 1:53 PM, Huihong Luo <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" target=_blank rel=nofollow ymailto="mailto:huisinro@yahoo.com">huisinro@yahoo.com</A>> wrote:<BR><BR></DIV>
<DIV></DIV>
<BLOCKQUOTE type="cite">
<DIV>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top>
<DIV>did more debugging, and I found adding QCoreApplication::processEvents() might help to solve the freeze problems when powering off with saving state. Add "QCoreApplication::processEvents();" as first line to the following two methods.</DIV>
<DIV> </DIV>
<DIV>if there is no other side effects, pls check in the changes:</DIV>
<DIV> </DIV><FONT size=2>
<DIV>UIMachineLogic.cpp:</DIV></FONT>
<DIV> </DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2></FONT></FONT>
<DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> UIMachineLogic::sltMachineStateChanged()</FONT></DIV><FONT size=2>
<DIV>{</DIV></FONT>
<DIV><FONT color=#008000 size=2><FONT color=#008000 size=2>// this is extremely import, freezes when hibernating otherwise</FONT></FONT></DIV><FONT color=#008000 size=2><FONT color=#008000 size=2></FONT></FONT><FONT size=2>
<DIV>QCoreApplication::processEvents();</DIV></FONT>
<DIV> </DIV>
<DIV>...</DIV>
<DIV> </DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV>UIMachineView.cpp:</DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2></FONT></FONT>
<DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> UIMachineView::sltMachineStateChanged()</FONT></DIV><FONT size=2>
<DIV>{</DIV></FONT>
<DIV><FONT color=#008000 size=2><FONT color=#008000 size=2>// this is extremely import, freezes when hibernating otherwise</FONT></FONT></DIV><FONT color=#008000 size=2><FONT color=#008000 size=2></FONT></FONT><FONT size=2>
<DIV>QCoreApplication::processEvents();</DIV></FONT>
<DIV>...</DIV>
<DIV>}<BR><BR>--- On <B>Mon, 8/9/10, Huihong Luo <I><<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" target=_blank rel=nofollow ymailto="mailto:huisinro@yahoo.com">huisinro@yahoo.com</A>></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Huihong Luo <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" target=_blank rel=nofollow ymailto="mailto:huisinro@yahoo.com">huisinro@yahoo.com</A>><BR>Subject: Re: [vbox-dev] savestate still hangs sometimes (reported before)<BR>To: <A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow ymailto="mailto:vbox-dev@virtualbox.org"><A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A></A><BR>Date: Monday, August 9, 2010, 10:12 AM<BR><BR>
<DIV id=yiv1515176730yiv221283057>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top>
<DIV>I did some more investigation, the hang is caused by this call:</DIV>
<DIV> </DIV><FONT size=2></FONT>
<DIV><FONT size=2>DECLCALLBACK(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2>) Console::saveStateThread(RTTHREAD Thread, </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> *pvUser)</FONT></DIV><FONT size=2>
<DIV>{</DIV>
<DIV> </DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2></FONT></FONT>
<DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> vrc = VMR3Save(that->mpVM,</FONT></DIV><FONT size=2>
<DIV>task->mSavedStateFile.c_str(),</DIV></FONT>
<DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>false</FONT></FONT><FONT size=2>, </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>/*fContinueAfterwards*/</FONT></FONT></DIV><FONT color=#008000 size=2><FONT color=#008000 size=2></FONT></FONT><FONT size=2>
<DIV>Console::stateProgressCallback,</DIV></FONT>
<DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>static_cast</FONT></FONT><FONT size=2><VMProgressTask*>(task.get()),</FONT></DIV><FONT size=2>
<DIV>&fSuspenededBySave);                      <====</DIV></FONT></FONT>
<DIV> </DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV>after 0% was printed out, VMR3Save() never returns.</DIV>
<DIV> </DIV>
<DIV>Interestingly, the freeze might to do with 2D accleration, because if I disble 2D acceleration, it does not occur that often. </DIV>
<DIV> </DIV>
<DIV>The freeze won't occur if doing saving state from the vm GUI console, the Close button.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR><BR>--- On <B>Fri, 7/23/10, Huihong Luo <I><<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" target=_blank rel=nofollow ymailto="mailto:huisinro@yahoo.com">huisinro@yahoo.com</A>></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Huihong Luo <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" target=_blank rel=nofollow ymailto="mailto:huisinro@yahoo.com">huisinro@yahoo.com</A>><BR>Subject: savestate still hangs sometimes (reported before)<BR>To: <A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow ymailto="mailto:vbox-dev@virtualbox.org"><A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A></A><BR>Date: Friday, July 23, 2010, 6:53 PM<BR><BR>
<DIV id=yiv1515176730yiv221283057yiv60347997>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top>
<DIV>when 2D acceleration is enabled</DIV>
<DIV> </DIV>
<DIV>c:\virtualbox-dev\vbox\out\win.x86\release\bin>VBoxManage.exe controlvm vm1 savestate<BR>0%...</DIV>
<DIV> </DIV>
<DIV>hangs after 0% is displayed.</DIV>
<DIV> </DIV>
<DIV>If doing from the Close menu, after dialog box is displayed, then choose Save State, then works well.</DIV>
<DIV> </DIV>
<DIV>I tried to break the code, it seems stop inside some Windows message loop.</DIV>
<DIV> </DIV>
<DIV>renderspu_init.c<BR>renderSPUWindowThreadProc()</DIV>
<DIV>{</DIV>
<DIV>...</DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<DIV>else</DIV></FONT></FONT><FONT size=2>
<DIV>{</DIV>
<DIV>TranslateMessage(&msg);</DIV>
<DIV>DispatchMessage(&msg);</DIV>
<DIV>}</DIV>
<DIV>...</DIV></FONT>
<DIV>}</DIV>
<DIV> </DIV>
<DIV>This is very annoying. need to fix these crash bugs when vm is shutting down.</DIV></TD></TR></TBODY></TABLE></DIV></BLOCKQUOTE></TD></TR></TBODY></TABLE></DIV><BR>-----Inline Attachment Follows-----<BR><BR>
<DIV class=yiv1515176730plainMail>_______________________________________________<BR>vbox-dev mailing list<BR><A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow><A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A></A><BR><A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target=_blank rel=nofollow><A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target=_blank rel=nofollow>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A></A><BR></DIV></BLOCKQUOTE></TD></TR></TBODY></TABLE></DIV></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<DIV><SPAN>_______________________________________________</SPAN><BR><SPAN>vbox-dev mailing list</SPAN><BR><SPAN><A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" target=_blank rel=nofollow ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A></SPAN><BR><SPAN><A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target=_blank rel=nofollow>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A></SPAN><BR></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE></td></tr></table>