abstratt / eclipsegraphviz

EclipseGraphviz makes it easier to integrate Graphviz into Eclipse applications.
Eclipse Public License 1.0
23 stars 13 forks source link

Shorten dot input in case of TimeOutException #8

Open lemmy opened 6 years ago

lemmy commented 6 years ago

When the dot process (com.abstratt.graphviz.GraphViz.runDot(String...)) runs into a TimeOutException due to an excessive size of the dot input, the full input is attached to the IStatus (com.abstratt.graphviz.GraphViz.logInput(ByteArrayOutputStream)) and subsequently printed to the console (com.abstratt.imageviewer.AbstractGraphicalContentProvider.ContentLoader.run(IProgressMonitor)).

Instead, in case of a TimeOutException only attach an excerpt of the dot input to IStatus. The root cause for the TimeOutException is likely to be caused by the excessive size of the dot input.

abstratt commented 6 years ago

@lemmy Can you add more info to make it obvious to anyone why the current behaviour is problematic?

lemmy commented 6 years ago

The behaviour is problematic because it clutters the log with several thousand lines of dot input. If additionally one happens to print the log to Eclipse's console, it can crash the IDE with a heap overflow.

abstratt commented 6 years ago

Thanks, quite compelling when you put it like that!

abstratt commented 6 years ago

@lemmy Few questions for you:

  1. Have you tried running dot against the large input via command line? Does it really take longer than 1 minute (current threshold)? How long does it take (on your setup)?
  2. If so, maybe we should raise the timeout threshold in EclipseGraphviz?
  3. If not, then I'd rather investigate why EclipseGraphviz takes longer to run Graphviz than via command-line (sorry, not really a question)
  4. How long is the DOT string that is causing the error?
  5. Is it generated by you, or some other tool (like the TextUML Toolkit)?
  6. Shouldn't we limit the dot input string that is logged in the case of error always, no matter the cause was a timeout or not?
lemmy commented 6 years ago
  1. markus@avocado:~/src/TLA/EWD840.toolbox/Model_3$ time dot -Tpdf Model_3.dot > Model_3.pdf ^C real 32m4.793s user 32m0.840s sys 0m0.520s

It's a state graph with a few thousand nodes.

  1. markus@avocado:~/src/TLA/EWD840.toolbox/Model_3$ wc -l Model_3.dot 14059 Model_3.dot

  2. The DOT string is generated by TLC - an explicit state model checker

  3. Not sure

By the way, I'm aware that visualizing a graph with more than a few dozen nodes make little sense anyway. However, Graphviz shouldn't crash the Eclipse IDE if one is so stupid to actually try and show such a graph in the image viewer.