[68228 Open] Closing Android debugger pegs CPU to 100%

When I run an Oxygene for Java project on my Ouya under the debugger, if I close the app, either by exiting it on the Ouya or by killing the debugger, my fan begins to blow really hard and Task Manager shows me with devenv.exe (Visual Studio) burning 1 CPU core at 100%. This continues until I exit or kill Visual Studio, and it appears to happen with any and every Android app.

Hi,

what version of Oxygene and Visual Studio you are using?
Does this happen on simulator or another device?

I’m on the latest release version of Oxygene, with Visual Studio 2012. I haven’t tested it with simulators or other devices. Further testing shows that this doesn’t always happen, but it happens very consistently if the device is powered off after debugging, or if the dev system is put to sleep and then resumed.

Hello,

Sorry for the delay. We tried to reproduce it here several times, with different android devices but couldn’t. Could you please next time it happens try to attach Vs to the hanging IDE and press “Break all” and give us the stack trace?

Thanks in advance.

It’s not hung; the IDE remains responsive. But something is clearly caught in an infinite loop somewhere. I’ll try that next time it happens and get you some data.

Here’s what I get as the call stack:

[Thread 15512] Parser Thread: (this is the thread the debugger broke to)

mscorlib.dll!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext) + 0x22 bytes    
     mscorlib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout, bool exitContext) + 0x28 bytes    
     mscorlib.dll!System.Threading.WaitHandle.WaitOne() + 0x10 bytes    
     RemObjects.Oxygene.Tools.dll!B.D.ThreadProc() + 0x158 bytes    
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x6f bytes    
     mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes    
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes    
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes    
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes    
     [Native to Managed Transition]

[Thread 23620] Main Thread:
The current thread is not currently running code or the call stack could not be obtained

[Thread 15240] StatusBar:

WindowsBase.dll!MS.Win32.UnsafeNativeMethods.GetMessageW(ref System.Windows.Interop.MSG msg, System.Runtime.InteropServices.HandleRef hWnd, int uMsgFilterMin, int uMsgFilterMax) + 0x14 bytes    
     WindowsBase.dll!System.Windows.Threading.Dispatcher.GetMessage(ref System.Windows.Interop.MSG msg, System.IntPtr hwnd, int minMessage, int maxMessage) + 0x80 bytes    
     WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) + 0x75 bytes    
     WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x49 bytes    
     WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x4b bytes    
     Microsoft.VisualStudio.Shell.11.0.dll!Microsoft.Internal.VisualStudio.PlatformUI.BackgroundDispatcher.ThreadProc(object arg) + 0x45 bytes    
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x9c bytes    
     mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes    
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes    
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes    
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj) + 0x4e bytes    
     [Native to Managed Transition]

[Thread 4664] Worker Thread:

System.dll!System.Net.Sockets.Socket.Receive(byte buffer = {byte[4]}, int offset = 0, int size, System.Net.Sockets.SocketFlags socketFlags = None, out System.Net.Sockets.SocketError errorCode = Success) + 0xbd bytes    
     System.dll!System.Net.Sockets.Socket.Receive(byte buffer, int offset, int size, System.Net.Sockets.SocketFlags socketFlags) + 0x1d bytes    
     System.dll!System.Net.Sockets.NetworkStream.Read(byte buffer, int offset, int size) + 0x83 bytes    
     RemObjects.Oxygene.CrossBoxClient.dll!RemObjects.Oxygene.Java.Debugging.ADBCommand.Read(byte d = {byte[4]}, int pos = 0, int len = 4) + 0x54 bytes    
     RemObjects.Oxygene.CrossBoxClient.dll!RemObjects.Oxygene.Java.Debugging.ADBCommand.WaitForResponse() + 0x49 bytes    
     RemObjects.Oxygene.CrossBoxClient.dll!RemObjects.Oxygene.Java.Debugging.ADBCommand.Shell(string aDevice = “192.168.1.2:5555”, string aCommand = “cat /system/build.prop”, int aTimeout = 500, System.Action aOutput = {Method = Cannot evaluate expression because a native frame is on top of the call stack.}) + 0x128 bytes    
     RemObjects.Oxygene.CrossBoxClient.dll!RemObjects.Oxygene.CrossBox.CooperClientLocal.UpdateAndroidDevices(object aState = null) + 0xb7a bytes    
     mscorlib.dll!System.Threading.TimerQueueTimer.CallCallbackInContext(object state) + 0x2c bytes    
     mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes    
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes    
     mscorlib.dll!System.Threading.TimerQueueTimer.CallCallback() + 0x71 bytes    
     mscorlib.dll!System.Threading.TimerQueueTimer.Fire() + 0xc0 bytes    
     mscorlib.dll!System.Threading.TimerQueue.FireQueuedTimerCompletion(object state) + 0x25 bytes    
     mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() + 0x34 bytes    
     mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() + 0x149 bytes    
     mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() + 0x5 bytes    
     [Native to Managed Transition]

[Thread 9184] In-proc Node (Default):

mscorlib.dll!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle waitHandles, int millisecondsTimeout, bool exitContext) + 0x92 bytes    
     Microsoft.Build.dll!Microsoft.Build.BackEnd.InProcNode.Run(out System.Exception shutdownException = null) + 0xad bytes    
     Microsoft.Build.dll!Microsoft.Build.BackEnd.NodeProviderInProc.InProcNodeThreadProc() + 0x18 bytes    
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x6f bytes    
     mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes    
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes    
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes    
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes    
     [Native to Managed Transition]

[Thread 19872] Parser Thread:

mscorlib.dll!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext) + 0x22 bytes    
     mscorlib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout, bool exitContext) + 0x28 bytes    
     mscorlib.dll!System.Threading.WaitHandle.WaitOne() + 0x10 bytes    
     RemObjects.Oxygene.Tools.dll!B.D.ThreadProc() + 0x158 bytes    
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x6f bytes    
     mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes    
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes    
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes    
     mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes    
     [Native to Managed Transition]

(Plus a handful of threads with no name that all say “The current thread is not currently running code or the call stack could not be obtained”)

I hope this helps!

Thanks, logged as bugs://68228: Closing Android debugger pegs CPU to 100%

Hello,

Do you still see that issue reproducing? I’m afraid it is difficult to fix it without reproducing here. The InternalWaitOne method from callstack doesn’t take CPU. Maybe you have any steps on how to reproduce it with emulator etc.

Thanks in advance.