viz-js icon indicating copy to clipboard operation
viz-js copied to clipboard

Large diagram fails on Chrome / Safari

Open mstefaniuk opened this issue 9 years ago • 9 comments
trafficstars

I've checked with https://gist.github.com/mjpieters/29623e9585fd694cdcc5 and it crashed with Uncaught RangeError: Maximum call stack size exceeded. Maybe there is a place for optimizations.

mstefaniuk avatar Dec 09 '15 19:12 mstefaniuk

Hi @mstefaniuk I have tested your super large graph in my local install of viz.js and no error. It generates a super large image. And not too slow either. Loving the viz.js, Well done @mdaines

large graphviz

ghost avatar Dec 10 '15 11:12 ghost

@aquaalex Strange but maybe only little bit. Today I've repeated test on official viz.js demo site on Windows and it works both on Firefox and Chrome. Yesterday I've checked it on Firefox, Chrome and Safari on OS/X - last two returned error I mentioned. Maybe it's only a OS/X error? Or maybe it happens when viz.js is deployed within WebWorker?

mstefaniuk avatar Dec 10 '15 12:12 mstefaniuk

@mstefaniuk maybe it is worth it looking at different versions of browsers? Not sure about the WebWorker issue, but that should be an easy test.

ghost avatar Dec 10 '15 13:12 ghost

I've checked it just now and when launched on Chrome 47.0.2526.80 (64-bit) on OS/X I've received original error. The same on Safari 9.0.1 (11601.2.7.2).

Chrome screenshot

Safari screenshot

mstefaniuk avatar Dec 11 '15 20:12 mstefaniuk

Just for Info I have tested Viz.js on a few versions of Windows and Android and a few versions of browsers

O/S: Windows 8.1 Firefox 43 Google Chrome 47 Internet Explorer 11

Android 5.0 Google Chrome 47

Windows 7: Internet Explorer 9 Internet Explorer 8 - Javascript Error

Windows Server 2003 EE SP2: Firefox 25 Google Chrome 20 Internet Explorer 7 - Javascript Error

ghost avatar Dec 31 '15 09:12 ghost

@mstefaniuk & @mdaines - It definitely seems to be an OSX issue, I wonder if anyone has tested it on any other Apple products.

Maybe the topic should be changed to: Large diagram fails on OSX(Apple)?

ghost avatar Dec 31 '15 09:12 ghost

@aquaalex For sure there is one OS/X exception with Firefox. It looks rather as OS/X Webkit issue.

mstefaniuk avatar Dec 31 '15 10:12 mstefaniuk

I was curious as to what was causing the overflow and it seems to be depth-first search graph algorithms in GraphViz like inter_tree_edge_search and dfs_range. screen shot 2018-02-10 at 12 06 35 pm

Recalling some of my related previous research, different browsers will have different maximum stack depths. And this will also depend on other factors such as stack frame size. Isolating it to a specific browser version or OS unfortunately won't help, as there doesn't seem to be a standard size that can be depended on, and a large enough input can always exceed it regardless. Sounds like this ticket can be closed in favor of opening a ticket with GraphViz to perhaps make the algorithms iterative or tail call (although I'm not sure Emscripten can do anything with tail call optimization.)

patrickpilch avatar Feb 10 '18 18:02 patrickpilch

this issue was introduced in 1.8.0, you won't have this issue on site viz-js.com becuase it has 1.7.1 version installed

zmitry avatar Aug 15 '18 18:08 zmitry

I'm closing this since I could get the graph to render in Safari using a build from the v3 branch. That branch is also substantially different from the version of Viz.js this issue would have appeared in -- it uses WebAssembly and a newer version of Graphviz.

However, the v3 version can still run into problems like this with larger graphs -- I found that I could get a RangeError: Maximum call stack size exceeded error in Node.js with a graph of 8000 nodes.

Maybe related? https://github.com/emscripten-core/emscripten/issues/13043

mdaines avatar Jun 13 '23 21:06 mdaines