python: deadlocked when using several subprocesses
I have had to use the following changes to be able to build correctly the SVG of some large automaton:
commit 49394a3c541826e7fd943c468a6d344ab7a259c7
Author: Akim Demaille <akim@lrde.epita.fr>
Date: Fri Dec 11 15:16:30 2015 +0100
wip: disable stderr recovery
For some reason, when the graph is large and dot takes too long, we
get deadlocked and the pipeline does not terminate.
Meanwhile discard stderr.
* python/vcsn/dot.py: here.
diff --git a/python/vcsn/dot.py b/python/vcsn/dot.py
index 37d4975..50bbe80 100644
--- a/python/vcsn/dot.py
+++ b/python/vcsn/dot.py
@@ -126,9 +126,11 @@ def _dot_to_svg(dot, engine='dot', *args):
"The conversion of a Dot source into SVG by dot."
# http://www.graphviz.org/content/rendering-automata
p1 = Popen([engine] + list(args),
- stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
- p2 = Popen(['gvpr', '-c', 'E[head.name == "F*" && head.name != "Fpre"]{lp=pos=""}'],
- stdin=p1.stdout, stdout=PIPE, stderr=PIPE,
+ stdin=PIPE, stdout=PIPE, # FIXME: stderr=PIPE,
+ universal_newlines=True)
+ p2 = Popen(['gvpr', '-c',
+ 'E[head.name == "F*" && head.name != "Fpre"]{lp=pos=""}'],
+ stdin=p1.stdout, stdout=PIPE, # FIXME: stderr=PIPE,
universal_newlines=True)
p3 = Popen(['neato', '-n2', '-Tsvg'],
stdin=p2.stdout, stdout=PIPE, stderr=PIPE,
Of course losing the error message is not the right approach. Maybe we should not care and just run a single pipe deferred to the shell (which means that we need to pay attention to escaping the characters...). Or some other cleaner scheme to do it.
ADL seems to have interesting ideas on how to avoid this problem.