Chromecast keeps freezing during debugging - debugging

I am connecting to chromecast (1st generation model) on port 9222 and I click the shield icon to get debug scripts loaded. Debugger starts fine and I can add breakpoints and see console log. But when I start interacting with the debugger, or a break point is hit, or I start examining the objects in console, the chromecast starts freezing. The video playback becomes choppy, sometimes completely halts. Removing the breakpoints doesn't solve the playback issues, and I have completely disconnect and reconnect. Many a times, a video frame stays frozen on the TV and disconnecting doesnt make it go away, so I have to reboot the chromecast. Sometimes the debugger disconnects and I have to refresh debug window.
It happens so frequently that I can't get the debugger to stay connected longer than 5-15 seconds after starting debugging, which means I am disconnecting/reconnecting or rebooting chromecast for every few seconds of debugging.
I tried rebooting chromecast (many many times), restarting my browser, reinstalling my cast extension, trying different chromecast device and even trying different router. Is there any way or trick to get a solid non-interrupting debugging session going with chromecast device?

Unfortunately there is a bug in the chrome remote debugger (a memory leak) that causes chromecast to freeze, crash or become unstable. It usually happens after a few minutes of connectivity so I am surprised that you mentioned it happens within 18 seconds; did you mean 18 seconds after the debugger is connected or after you hit the breakpoint? Regardless, the issue that I mentioned with the debugger is there and there is an internal ticket to address that; currently there is no work around. If in your case it is really as early as 18 seconds from the time you connect, then something else might be going on as well; can you please try that on a different app (if you have one) to see if it exhibits the same issue?

Related

Windbg break-in takes very long time

I want to capture a stacktrace of an application which sometimes stops responding for few minutes.
When the application stops responding, the windows desktop also stops responding to mouse clicks, although some other already running applications are working fine at that time (for example windbg works fine, ProcessExplorer refreshes its screen, but does not respond to mouse events).
While the application is non responsive, it is actually taking about 80% of one CPU core. That is why I would like to get a stacktrace.
The misbehaving application usually takes about 2-3 minutes to do its strange job or if Ctrl+Esc is pressed it becomes responsive immediately (and the start menu opens of course...)
I have WinDbg attached to the misbehaving application and when I issue the Break command, the break-in does not happen until the application starts to respond again.
From what I understand the break-in actually creates a remote thread which pretty soon calls DbgBreakPoint.
What could be preventing debugger's thread from executing?
EDIT:
First of all thanks for your help!
I was also thinking that this might be caused by a bad device driver or something that installs a system wide hook somewhere.
I was thinking to enable kernel debugging and get a stack trace from the kernel for the offending thread or enable manual bluescreen trigger to produce a dump and look at that afterwards.
Process Explorer and Process Monitor does not reveal anything interesting. They also become unusable when the bug is triggered (updating their windows but not responsive to mouse or keyboard).
EDIT2:
Background info:
App uses QT, OpenGL and also DirectSound and runs on Windows 7 SP1 x64
I am currently suspecting something with the graphics part.
The strange thing is that if a system-wide lock is taken (like GDI Lock), this would prevent drawing of other Windows, but that does not happen. WinDbg on same machine works fine. ProcessExplorer updates but does not receive mouse clicks, Desktop updates but no mouse clicks.
I currently have a kernel debugger attached...
EDIT3
ETW was most useful for debugging. It turns out that Qt's main event processing loop goes crazy. PeekMessage and MsgWaitForMultipleObjectsEx (with 0 timeout) gets called in a tight loop. That is where the high CPU usage comes from.
It looks like the App is generating/getting loads of messages at that time. But it is not easy to see what the messages are (or I don't know how to access function parameters in ETW). Using a debugger also does not help much but, with a breakpoint in the QT's event loop leads me to believe that WM_TIMER messages are the culprit.
Given that the desktop also misbehaves during this time, it sounds like your app isn't necessarily misbehaving but merely aggravating a bug elsewhere (e.g., in a device driver or some crummy anti-malware code that has injected itself into other processes). Stack traces from your app may or may not be very revealing.
If the problem is easily reproducible, I'd set a breakpoint somewhere in the "middle" of the app and see if the problem happens before or after that. Then move the breakpoint until you find the last instruction your app executes before things go bonkers. Figuring out what your app does that triggers this behavior may give a clue as what's going on.
Another option is to try using some system-wide debugging tools. First, I'd peak in the Event Viewer to see if there are suspicious error or warning events posting in proximity to the moment the machine goes haywire. Then I'd try a tool like Sysinternal's Process Monitor or Process Explorer to get a better view of what's happening. You might also try ETW to capture a system-wide trace of what's happening on the system that you can study after the fact. (ETW can be hard to use, so check out Bruce Dawson's UIforETW.)
Use ETW to find the cause. Install the Windows Performance Toolkit (part of the Win10 v1511 SDK: https://go.microsoft.com/fwlink/p/?LinkID=698771 which is the last version that works in Win7), run WPRUI.exe, select CPU Usage and click on Start.
After you captured the hang, click on Save. Wait until WPRUI is finished, open the ETL in WPA, setup and load debug symbols in WPA.
Drag & Drop the CPU Usage (Precise) graph to analyse pane and look for WAIT (µs) max for your process to see that long hang and expand the stack to see where it happens.

WebVR mobile browser screen timeout

Every WebVR app on Android I tried become completely useless after 30 second due to screen timeout in the browser. Is there anyway to prevent it?
There is a (somewhat hacky) solution for this that is being used by the webvr-poyfill.
Android doesn't go to sleep when a video is being played back, so even creating an invisble video-element and playing it will disable the inactive-timeout.
On iOS, a page navigation is initiated and immediately stopped every 30 seconds to keep the screen awake.
Also note that this problem will probably go away when chrome for android ships the real WebVR implementation (probably sometime later this year, when the new daydream-compatible pixel/pixel XL-phones are released)
I think you might find that unless you're on desktop the browser itself is unable to keep the screen on. Instead this can only be sustained by a third party app, or more simply by the user directly through settings.
Simplest solution might be to ask user to adjust settings.

Flash Debugger crashes Safari relentlessly

Ever since Flash Player 10 came out, the debugger version causes what seems like a crash in my browser, either Safari, or Firefox, on Mac OS X. It's been consistently happening with 10.0, 10.1 and 10.2.
And it's not just on the applications I develop. Six or seven times out of ten, when I visit sites like Gamespot with Flash video delivery and a banner ad or two, the debugger kicks out an error and, upon dismissing that error, I can't regain focus of my browser. Clicking a window does nothing but trigger the Mac OS X error sound. I have to force-quit and start again.
The Adobe forums have been no help, and everything else I've seen relative to the debugger crash issues doesn't seem to solve my problem. Any ideas?
I'm not sure if this works on a Mac as well, but on a Windows machine, this hack saved me already some time: Often it is just enough to kill the task "plugin-container.exe". This will stop all flash movies immediately and unfreeze your browser. So you can work on without losing all work done in other browser tabs and waiting for your browser to restart.

Debugging mobile software in the VS device emulator - app switching to background

I have this issue when debugging mobile apps on the emulator. When I press F5, the build starts, then the deploy, then the app pops up in the emulator.
Because this takes a minute or 2, I am checking my SO score and maybe ask a question while I wait, and the emulator is in the background. When I finally switch back to the emulator, it shows the start page, not my app.
I figured out that by pressing the back button I can bring the debugged application to the foreground, but still, I don't know what is pushing it into the background to begin with. Has anybody noticed this, and found a way to prevent it?
The default behavior in WinMo is that if the device has no activity for a certain period of time (set in Settings->Today->Items->Today Timeout), the Today screen will come to the fore. Check to see if that's what's happening (though I think the smallest interval is still larger than a couple minutes).

Emulate Sleeping Windows Mobile Device

Is it possible to emulate a device sleeping and waking using the Microsoft-supplied device emulators?
Yes, but you have to generate your own emulator image with a modified kernel (changing OEMPowerOff). Bruce Eitman blogged about it here. You didn't detail your needs, so it's hard to say, but you might be able to provide some form of simulation by manually setting the named power management events.
This is an old thread, but in case anyone else stumbles across it, you can make the Windows Mobile emulators 'sleep' and wake up, though not with the debugger attached.
Close the emulator window while your application is running and save the state. Or, configure power management to sleep the emulator at the desired time; the emulator will close and save its state automatically. If the debugger is attached, it will lose its connection and stop debugging.
Open Device Emulator Manager and click Refresh until the emulator shows up as disconnected (no icon next to it). Right-click on the emulator name and select Connect.
Emulator wakes up and reappears. If your application is listening for the wake-up notification, it will be signaled at this point.
You can also wake up the emulator using Debug > Attach to Process, though this does not always succeed. Either way, by the time the debugger attaches, the wake up sequence will already have executed. If you can get by with debug statements, though, this is easier than modding the emulator image.

Resources