[pypy-issue] Issue #2908: Segfault when reading a GraphViz file with Pygraphviz (pypy/pypy)

Shaun Jackman issues-reply at bitbucket.org
Thu Nov 1 13:47:04 EDT 2018

New issue 2908: Segfault when reading a GraphViz file with Pygraphviz

Shaun Jackman:

I installed Pypy3 6.0.0 and GraphViz 2.40.1 using Linuxbrew `brew install pypy3 graphviz`, and I installed Pygraphviz 1.5 and Networkx 2.2 using `pip_pypy3 install --user pygraphviz networkx`.

When I attempt to write a GraphViz file using `networkx.write_dot`, it segafults in `_IO_new_fdopen iofdopen.c:63` called by `_wrap_agwrite` in `_graphviz.pypy3-60-x86_64-linux-gnu.so`. It appears to be dereferencing a null pointer. Here's the backtrace:

(gdb) bt
#0  _IO_new_fdopen (fd=1, mode=0x0) at iofdopen.c:63
#1  0x00007fc0ef4fb759 in _wrap_agwrite ()
   from /home/sjackman/.local/lib/python3.5/site-packages/pygraphviz/_graphviz.pypy3-60-x86_64-linux-gnu.so
#2  0x00007fc0ed183984 in ?? ()
   from /gsc/btl/linuxbrew/Cellar/pypy3/6.0.0/lib/libpypy3-c.so
(gdb) x/i $pc
=> 0x7fc0eb9a67b <_IO_new_fdopen+11>:	movzbl (%rsi),%eax
(gdb) p/x $rsi
$1 = 0x0

This works as expected when using CPython 3.7.0 rather than Pypy3. For my purpose, I have found Pypy3 to be four times faster than CPython. Any thoughts on how to troubleshoot this issue?

See also https://github.com/pygraphviz/pygraphviz/issues/177

More information about the pypy-issue mailing list