Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when generating graph #65

Closed
boessu opened this issue Jun 6, 2016 · 5 comments
Closed

Error when generating graph #65

boessu opened this issue Jun 6, 2016 · 5 comments
Labels

Comments

@boessu
Copy link

boessu commented Jun 6, 2016

We try to integrate viz.js into plantuml. However, it seems as we get rarely an exception which looks as it has to do with viz.js. The .dot file works with GrapViz dot command line of course.

The following dot file generates an example abort exception:
svek2.txt

digraph unix {
sh0045->sh0020[arrowtail=none,arrowhead=none,color="#0000CC"];
subgraph cluster4p0 {
    label="";
    subgraph cluster4 {
        style=solid;
        color="#000004";
        label=<<TABLE BGCOLOR="#000005" FIXEDSIZE="TRUE" WIDTH="112" HEIGHT="12"><TR><TD></TD></TR></TABLE>>;
        subgraph cluster4p1 {
            label="";
            sh0006 [shape=rect,label="",width=1.250000,height=0.661241,color="#000006"];
            sh0007 [shape=rect,label="",width=1.208333,height=0.661241,color="#000007"];
            sh0008 [shape=rect,label="",width=1.069444,height=0.661241,color="#000008"];
        }
    }
}
sh0042->sh0020[arrowtail=none,arrowhead=none,minlen=1,color="#00003C"];
sh0016->sh0008[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000044",label=<<TABLE BGCOLOR="#000045" FIXEDSIZE="TRUE" WIDTH="169" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
sh0016->sh0020[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000048",label=<<TABLE BGCOLOR="#000049" FIXEDSIZE="TRUE" WIDTH="111" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
sh0016->sh0033[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#00004C",label=<<TABLE BGCOLOR="#00004D" FIXEDSIZE="TRUE" WIDTH="111" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
sh0008->sh0013[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000054",label=<<TABLE BGCOLOR="#000055" FIXEDSIZE="TRUE" WIDTH="111" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
sh0020->sh0008[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000058",label=<<TABLE BGCOLOR="#000059" FIXEDSIZE="TRUE" WIDTH="48" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
sh0007->sh0016[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000060",label=<<TABLE BGCOLOR="#000061" FIXEDSIZE="TRUE" WIDTH="88" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
}

Nashorn Exception:

Caused by: javax.script.ScriptException: abort() at Error
    at <anonymous> (<eval>:5)
    at <anonymous> (<eval>:5)
    at <anonymous> (<eval>:28)
    at <anonymous> (<eval>:5)
    at <anonymous> (<eval>:21)
    at <anonymous> (<eval>:11)
    at <anonymous> (<eval>:11)
    at <anonymous> (<eval>:9)
    at <anonymous> (<eval>:11)
    at <anonymous> (<eval>:5)
    at <anonymous> (<eval>:62)
    at <anonymous> (<eval>:44)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information. in <eval> at line number 28 at column number 5540
    at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:467)
    at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:389)
    at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:190)
    at ch.braincell.viz.NashornVizJS.execute(NashornVizJS.java:51)
    ... 1 more
Caused by: <eval>:28:5540 abort() at Error
    at <anonymous> (<eval>:5)
    at <anonymous> (<eval>:5)
    at <anonymous> (<eval>:28)
    at <anonymous> (<eval>:5)
    at <anonymous> (<eval>:21)
    at <anonymous> (<eval>:11)
    at <anonymous> (<eval>:11)
    at <anonymous> (<eval>:9)
    at <anonymous> (<eval>:11)
    at <anonymous> (<eval>:5)
    at <anonymous> (<eval>:62)
    at <anonymous> (<eval>:44)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
    at jdk.nashorn.internal.runtime.ECMAException.create(ECMAException.java:113)
    at jdk.nashorn.internal.scripts.Script$Recompilation$1117$3742376A$\^eval\_.L:1$Module$abort(<eval>:28)
    at jdk.nashorn.internal.scripts.Script$Recompilation$1116$603461$\^eval\_.L:1$Module$_abort(<eval>:5)
    at jdk.nashorn.internal.scripts.Script$Recompilation$233$3713689I$\^eval\_.:scopeCall(<eval>)
    at jdk.nashorn.internal.scripts.Script$Recompilation$233$3713689I$\^eval\_.L:1$Module$asm$O4(<eval>:21)
    at jdk.nashorn.internal.scripts.Script$Recompilation$1115$1311166I$\^eval\_.:scopeCall(<eval>)
    at jdk.nashorn.internal.scripts.Script$Recompilation$1115$1311166I$\^eval\_.L:1$Module$asm$zf(<eval>:11)
    at jdk.nashorn.internal.scripts.Script$Recompilation$1096$1307585I$\^eval\_.L:1$Module$asm$sf(<eval>:11)
    at jdk.nashorn.internal.scripts.Script$Recompilation$1095$811472II$\^eval\_.L:1$Module$asm$gF(<eval>:9)
    at jdk.nashorn.internal.scripts.Script$Recompilation$125$\^eval\_.L:1$Module$asm$ec(<eval>:11)
    at jdk.nashorn.internal.scripts.Script$Recompilation$115$7917AAAAA$\^eval\_.L:1$Module$L:5-6$ccallFunc(<eval>:5)
    at jdk.nashorn.internal.scripts.Script$Recompilation$5$3743661AAA$\^eval\_.L:1$render(<eval>:62)
    at jdk.nashorn.internal.scripts.Script$Recompilation$4$\^eval\_.L:1$Viz(<eval>:44)
    at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:614)
    at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
    at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
    at jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:199)
    at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:383)

V8 exception:

Caused by: undefined:28: abort() at Error
    at jsStackTrace (<anonymous>:5:20800)
    at stackTrace (<anonymous>:5:20983)
    at Object.abort (<anonymous>:28:5424)
    at _abort (<anonymous>:5:603400)
    at O4 (<anonymous>:21:14501)
    at zf (<anonymous>:11:124669)
    at Array.sf (<anonymous>:11:120869)
    at gF (<anonymous>:9:172965)
    at ec (<anonymous>:11:882)
    at Object.ccallFunc [as ccall] (<anonymous>:5:8080)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
forEach((function(decorator){output=decorator(output,what)}))}throw output}Mod
                                                                    ^
com.eclipsesource.v8.V8ScriptExecutionException
    at com.eclipsesource.v8.V8._executeFunction(Native Method)
    at com.eclipsesource.v8.V8.executeFunction(V8.java:995)
    at com.eclipsesource.v8.V8Function.call(V8Function.java:55)
    at ch.braincell.viz.V8VizJS.execute(V8VizJS.java:46)
@boessu
Copy link
Author

boessu commented Jun 8, 2016

We guess it has to do with the labels on arrows. Also issue #54 will work if you remove the labels.

@thambley
Copy link

thambley commented Jun 9, 2016

It looks like it is one label in particular causes the issue. I changed the color of the edge on the graph to red so you can see it better when the graph is generated.

digraph unix {
sh0045->sh0020[arrowtail=none,arrowhead=none,color="#0000CC"];
subgraph cluster4p0 {
    label="";
    subgraph cluster4 {
        style=solid;
        color="#000004";
        label=<<TABLE BGCOLOR="#000005" FIXEDSIZE="TRUE" WIDTH="112" HEIGHT="12"><TR><TD></TD></TR></TABLE>>;
        subgraph cluster4p1 {
            label="";
            sh0006 [shape=rect,label="",width=1.250000,height=0.661241,color="#000006"];
            sh0007 [shape=rect,label="",width=1.208333,height=0.661241,color="#000007"];
            sh0008 [shape=rect,label="",width=1.069444,height=0.661241,color="#000008"];
        }
    }
}
sh0042->sh0020[arrowtail=none,arrowhead=none,minlen=1,color="#00003C"];
sh0016->sh0008[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000044",label=<<TABLE BGCOLOR="#000045" FIXEDSIZE="TRUE" WIDTH="169" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
sh0016->sh0020[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000048",label=<<TABLE BGCOLOR="#000049" FIXEDSIZE="TRUE" WIDTH="111" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
sh0016->sh0033[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#00004C",label=<<TABLE BGCOLOR="#00004D" FIXEDSIZE="TRUE" WIDTH="111" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
sh0008->sh0013[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000054",label=<<TABLE BGCOLOR="#000055" FIXEDSIZE="TRUE" WIDTH="111" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
/*HERE---->*/ sh0020->sh0008[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#FF0000"]; 
sh0007->sh0016[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000060",label=<<TABLE BGCOLOR="#000061" FIXEDSIZE="TRUE" WIDTH="88" HEIGHT="18"><TR><TD></TD></TR></TABLE>>];
}

@boessu
Copy link
Author

boessu commented Jun 10, 2016

Yes, that seems to be the problem. It is the only label in the graph which forces the edge to "bend around" the label. Look on the red edge in the graph:

This one doesn't work with viz.js:
svek3labelerror

This one works:
svek3labelfine

The workaround is to use xlabel on on edges instead:
sh0020->sh0008[arrowtail=none,arrowhead=empty,arrowsize=0.5,minlen=1,color="#000058",xlabel="Test"];

To replace all "label=" on edges with "xlabel=" is also the workaround for bug #54.

Now at least we have some sort of a workaround. But I still hope for a fix in viz.js...

@mdaines
Copy link
Owner

mdaines commented Nov 23, 2016

This appears to not be a problem with generating the graph, but rather when cleaning up after rendering. Here is the stack trace with optimizations and closure compiler turned off and assertions turned on:

[Error] No message (1)
	abort (viz.js:409527)
	_abort (viz.js:5113)
	_free (viz.js:405847)
	_dot_cleanup_graph (viz.js:21525)
	_dot_cleanup (viz.js:20976)
	_gvFreeLayout (viz.js:193954)
	_vizRenderFromString (viz.js:6617)
	(anonymous function) (viz.js:409201)
	ccallFunc (viz.js:456)
	render (viz.js:409590)
	Viz (viz.js:409572)
	Global Code (example.html:27)

A quick test with the Graphviz API from C doesn't appear to have the same issue. So this may have something to do with how Emscripten manages memory.

I was able to find a reduced test case, however. As suggested above, the issue seems to depend on the particular layout the engine chooses.

digraph g {
node001->node002;
subgraph cluster1 {
    node003;
    node004;
    node005;
}
node006->node002;
node007->node005;
node007->node002;
node007->node008;
node002->node005[label="x"];
node004->node007;
}

This graph also throws an exception with Viz.js, and crashes when using the Graphviz API from C:

digraph G {
    subgraph g {
    }
}

mdaines added a commit that referenced this issue Jan 14, 2017
mdaines added a commit that referenced this issue Jan 14, 2017
mdaines added a commit that referenced this issue Jan 14, 2017
@mdaines
Copy link
Owner

mdaines commented Jan 14, 2017

This should be addressed in 2257a40. Viz.js will no longer attempt to clean up in its C code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants