Modify

Opened 16 years ago

Closed 16 years ago

Last modified 12 years ago

#3605 closed defect (fixed)

IOError: [Errno 32] Broken pipe when rendering graph

Reported by: Russ Brown Owned by: Christian Boos
Priority: high Component: GraphvizPlugin
Severity: critical Keywords:
Cc: Trac Release: 0.11

Description

The grahviz plugin used to work justfine for us, but at some point over the last few months it stopped doing so.

In that time we upgraded to 0.11, and also upgrade graphviz itself a number of times, so it it difficult to pinpoint exactly what caused the problem.

Anyway, the backtrace we are getting is as follows:

2008-08-25 15:52:41,487 Trac[main] ERROR: [Errno 32] Broken pipe
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 219, in dispatch
    data, content_type)
  File "/usr/lib/python2.5/site-packages/trac/web/chrome.py", line 726, in render_template
    stream.render(method, doctype=doctype, out=buffer)
  File "/usr/lib/python2.5/site-packages/genshi/core.py", line 179, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/usr/lib/python2.5/site-packages/genshi/output.py", line 61, in encode
    for chunk in iterator:
  File "/usr/lib/python2.5/site-packages/genshi/output.py", line 311, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/genshi/output.py", line 753, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/genshi/output.py", line 592, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/genshi/output.py", line 698, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/usr/lib/python2.5/site-packages/genshi/output.py", line 532, in __call__
    for ev in stream:
  File "/usr/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/trac/web/chrome.py", line 779, in _strip_accesskeys
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/trac/web/chrome.py", line 768, in _generate
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 569, in _include
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/markup.py", line 298, in _match
    ctxt, start=idx + 1, **vars):
  File "/usr/lib/python2.5/site-packages/genshi/template/markup.py", line 298, in _match
    ctxt, start=idx + 1, **vars):
  File "/usr/lib/python2.5/site-packages/genshi/template/markup.py", line 245, in _match
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 543, in _exec
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 533, in _eval
    for event in substream:
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 496, in _eval
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 551, in _flatten
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/path.py", line 141, in _generate
    subevent = stream.next()
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 569, in _include
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/markup.py", line 234, in _strip
    event = stream.next()                                                                               
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 543, in _exec
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 533, in _eval
    for event in substream:
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 496, in _eval
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 551, in _flatten
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/path.py", line 141, in _generate
    subevent = stream.next()
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 569, in _include
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/markup.py", line 234, in _strip
    event = stream.next()
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 543, in _exec
    for event in stream:
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 520, in _eval
    result = _eval_expr(data, ctxt, **vars)
  File "/usr/lib/python2.5/site-packages/genshi/template/base.py", line 286, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/usr/lib/python2.5/site-packages/genshi/template/eval.py", line 180, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "/usr/lib/python2.5/site-packages/trac/wiki/templates/wiki_view.html", line 37, in <Expression u'wiki_to_html(context, page.text)'>
    ${wiki_to_html(context, page.text)}
  File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1095, in format_to_html
    return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
  File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1054, in generate
    escape_newlines)
  File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 833, in format
    self.handle_code_block(line)
  File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 764, in handle_code_block
    processed = self.code_processor.process(code_text)
  File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 179, in process
    text = self.processor(text)
  File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 166, in _macro_processor
    text)
  File "build/bdist.linux-i686/egg/graphviz/graphviz.py", line 227, in expand_macro
    out, err = self.launch(cmd, content)
  File "build/bdist.linux-i686/egg/graphviz/graphviz.py", line 430, in launch
    p.stdin.write(input)
IOError: [Errno 32] Broken pipe

Now, we do know that graphviz itself is installed and working properly on the server because it works just fine with the masterticket plugin: this only seems to affect the graphviz plugin.

Any help would be appreciated: we miss our graphs. :)

Attachments (0)

Change History (11)

comment:1 Changed 16 years ago by franck34

Seem's a problem occured when launching graphviz tools.

In the source code, there is some debug message. Uncomment them to see all command line which are launched (2 in general). Then, try to launch them manualy. If you got a segfault or something like that, it's related to your graphviz install, but not the plugin.

Please tell us if you are using win32 or linux and which install (mod_python, other ...)

comment:2 Changed 16 years ago by Russ Brown

Hi, thanks for your response.

We are running on gentoo linux with trac running through mod_python.

I enabled the debugging as requested and got the following output:

2008-09-24 14:23:40,273 Trac[graphviz] DEBUG: render_macro: render other image formats - running command [u'/usr/bin/dot', '', u'-Tpng', u'-o/var/tmp/trac/htdocs/graphviz/dbbc42700225787cb9bb6fb6f1dd75d24734b999.dot.png']
2008-09-24 14:23:40,282 Trac[graphviz] ERROR: The command
   [u'/usr/bin/dot', '', u'-Tpng', u'-o/var/tmp/trac/htdocs/graphviz/dbbc42700225787cb9bb6fb6f1dd75d24734b999.dot.png']
failed with the the following output:

Error: dot: can't open

/usr/bin/dot definitely exists and belongs to the graphviz package:

# /usr/bin/dot -V
dot - Graphviz version 2.20.2 (Mon Aug 25 13:07:52 UTC 2008)

If I just run the comment given:

/usr/bin/dot -Tpng -o/var/tmp/trac/htdocs/graphviz/8ba4511395eb047b7d14f21f88f78738037acddd.dot.png

It just sits there, presumably waiting for data to be piped to it?

As I say, graphviz works fine with the mastertickets plugin when rendering its depgraph.

comment:3 Changed 16 years ago by Christian Boos

I just had the same issue. The problem is in the above command:

[u'/usr/bin/dot', '', u'-Tpng', ...

Note the empty first argument, this is what triggers the Error: dot: can't open message.

Possible fix:

  • graphviz/graphviz.py

    diff -r abb5c1031a4e -r 8c16d9f0cdb3 graphviz/graphviz.py
    a b  
    424424
    425425    def launch(self, cmd, input):
    426426        """Launch a process (cmd), and returns exitcode, stdout + stderr"""
    427         p = subprocess.Popen(cmd,
     427        p = subprocess.Popen([arg for arg in cmd if arg],
    428428                             stdin=subprocess.PIPE,
    429429                             stdout=subprocess.PIPE,
    430430                             stderr=subprocess.PIPE)

comment:4 Changed 16 years ago by Christian Boos

Priority: normalhigh
Severity: normalcritical

Several duplicates (#3304, #3663), raising the priority and severity, as this prevents the plugin from working.

comment:5 Changed 16 years ago by Carlos

I'm debuging this issue too . I found that the empty second item in the 'cmd' Array is causing the bug. This item is empty if there's no default_* options in configuration

I workarrounded it placing a cmd.remove() and then worked for me.

I'm using trac 0.11 and mod_python

comment:6 Changed 16 years ago by Russ Brown

Adding the cmd.remove() worked for me too.

I'm sure the other way would also have worked too.

Thanks so much for looking at it. I have happy users again. :)

comment:7 Changed 16 years ago by bill.coffman@…

The patch in comment:3 also fixed #3756 ... thanks.

comment:8 Changed 16 years ago by kenneth

comment:3 works for me too!

comment:9 Changed 16 years ago by Christian Boos

Owner: changed from Peter Kropf to Christian Boos

patch from comment:3 applied in [4394], just because I had it lying around...

comment:10 Changed 16 years ago by Christian Boos

Resolution: fixed
Status: newclosed

... but a more extensive fix for this issue can be found in [4395] (avoiding the empty optional argument list altogether).

comment:11 Changed 12 years ago by anonymous

At my site it only works after I include a section in my trac.ini:

[graphviz]
cache_dir = /srv/www/htdocs/trac/gvcache
cache_manager = yes
cmd_path = /usr/local/bin
processor = dot
out_format = svg

More specifically when I set out_format to svg.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.