Canviz locks up browser when source file can't be loaded

24 views
Skip to first unread message

Fergus Gallagher

unread,
Mar 1, 2012, 7:35:02 AM3/1/12
to can...@googlegroups.com
I'm loading a dynamically generated xdot graph into Canviz.   The HTML is almost exactly as per the demo:

document.observe('dom:loaded', function() {
   new Canviz('canviz', '<path-to-dynamic-script>');
});

Sometimes the server script bombs out (HTTP 50x), and the browser CPU usage goes to 100% indefinitely. (The page is unresponsive so I can't get to anything to debug/trace.)

(I'm using Chrome 18.x)

Any suggestions?

Ryan Schmidt

unread,
Mar 1, 2012, 10:01:22 AM3/1/12
to can...@googlegroups.com

That doesn't surprise me, though it's obviously undesirable. I have done no testing so far of Canviz with malformed, truncated, or garbage documents, and would not be surprised if Canviz does not handle them gracefully, even to the extent that you've observed, running into an infinite loop trying to process data that isn't there. Some browsers, including Firefox, include protection from infinite loops and other runaway JavaScript code, and prompt you asking if you would like to interrupt the script; if you do your testing in such a browser, and interrupt the script at that point and open e.g. Firebug, you would be able to see exactly what it was doing. But it also probably wouldn't be difficult to construct some test cases of bad xdot documents and see how Canviz reacts to them. It's definitely something I still plan to do eventually.


Fergus Gallagher

unread,
Mar 1, 2012, 11:48:49 AM3/1/12
to can...@googlegroups.com
Perhaps I'll give it a go myself.

My initial eyeballing makes me think you should be using .onSuccess() not onComplete() in Ajax.Request().  I suspect that would cope with non-20x status codes, at least, but not necessarily with malformed data.  I suspect the latter is relatively unlikely for dot generated .xdot.

Fergus Gallagher

unread,
Mar 1, 2012, 12:15:44 PM3/1/12
to can...@googlegroups.com

My initial eyeballing makes me think you should be using .onSuccess() not onComplete() in Ajax.Request().  I suspect that would cope with non-20x status codes, at least, but not necessarily with malformed data.  I suspect the latter is relatively unlikely for dot generated .xdot.

Yes, changing onComplete() -> onSuccess works().   

Fergus Gallagher

unread,
Mar 1, 2012, 12:28:58 PM3/1/12
to can...@googlegroups.com

Yes, changing onComplete() -> onSuccess works().   

A basic sanity check would help though.  (I tried to test it with a 404 page but for some reason my webserver was configured to rewrite those as 200 + HTML, i.e.,  onSuccess was getting HTML)  Is there any character sequence that's ALWAYS present in an xdot file?
Reply all
Reply to author
Forward
0 new messages