I'm glad to hear JS debugging of the dev tools is so simple - I didn't even think to try the keyboard shortcut, thanks!
The particular problem we're seeing now (and perhaps ALL the problems we've had with hanging) is definitely related to large amounts of console logging. Debugging the dev tools and hitting pause when it appears hung, I get this callstack:
WebInspector.ResourceTreeModel.addConsoleMessage() at DevTools.js:9598
WebInspector.ConsoleView.addMessage() at DevTools.js:6178
dispatcher.messageAdded() at DevTools.js:6022
InspectorBackendStub.dispatch() at DevTools.js:3902
If I try any execution control (eg. step in), it gets stuck running (clicking pause greys out the pause button but never actually succeeds in pausing the dev tools again). Perhaps there's another bug there somewhere? But anyway this was enough for me.
In this particular case I believe the app we're trying to debug is (incorrectly) stuck in a loop that's outputting a log message every so often (not sure of the exact rate, but it's probably not that high). The dev tools appear to have non-linear performance characteristics with respect to the number of log messages. I can repro this with this simple app:
<html>
Log loop
<script>
var i = 0;
var last = new Date().getTime();
function sendlogmsg()
{
var newTime = new Date().getTime();
console.log ('Log message #' + i + ', Delta ms=' + (newTime - last));
i++;
last = newTime;
if (i < 5000)
window.setTimeout(sendlogmsg, 0);
}
window.setTimeout(sendlogmsg, 0);
</script>
</html>
The first 1500 log messages or so output fairly quickly (probably at the 200/sec rate they are getting generated at), then it hangs for a few seconds - repainting around 2500 and later 3000 messages, then hanging for many seconds until all 5000 are finally handled then the UI updates and becomes responsive again. It makes no difference if the messages are actually displayed (eg. if I tell dev tools to show me only errors), and it looks like the original app isn't being throttled at all (when I can finally view the full log - I see 4-5ms between each log message).
Should I file a Chromium or WebKit bug for this? Obviously we can work around this for now by disabling/throttling the logging in our app, but that's a less-than-ideal solution for the debug flavour of our app (logging has been very important for our diagnostics during development - we'd probably want to build some infrastructure to save all the messages and just let us select windows to send over to the JS console).
Some ideas:
- Hopefully there's just some algorithm that's being used that's inefficient on sizes >1000 or so - hopefully something can be changed to just give us a higher ceiling with reasonable perf.
- Regardless, perhaps their is a priority issue here - should a flood of log entries really block the devtools UI from being updated / responding to clicks completely?
- Worst case, perhaps there should be some flood protection - just disable console logging (with a warning) before things get terrible
Thanks,
Rick