mgedmin / objgraph

Visually explore Python object graphs
http://mg.pov.lt/objgraph/
MIT License
768 stars 72 forks source link

Graph output raises a syntax error in Dot #30

Closed kamakazikamikaze closed 7 years ago

kamakazikamikaze commented 7 years ago

I'm not entirely sure if this is an error in Objgraph or (X)Dot but I'll take my chances.

I'm trying to run down a leak caused by a C Extension that I'm refactoring. I was following the Reference Counting Bugs section of the quickstart guide when I had the "brilliant" idea to just graph everything for . . . well, stupid reasons.

(Please put your torch and pitchfork down.)

Dot didn't like the syntax output. I encountered the following message:

Graph written to /tmp/objgraph-t8r7rn7w.dot (3250 nodes)
Warning: /tmp/objgraph-t8r7rn7w.dot: syntax error in line 5857 near ','
Image generated as leaks_bulkwalk_py3.png

The image was not generated, however I managed to save the output Dot file with the code I used. Line 5857 contains the following: o21209296[label="str [1]\n'map(func, *iterables) --> map object\\n\\"]; I'm not familiar with Dot but, after reading a few sections of the file, I guess it either mis-parsed it as a function or perhaps commas are illegal in strings?

mgedmin commented 7 years ago

What's your graphviz version (dot -V prints it)? I cannot reproduce with

dot - graphviz version 2.38.0 (20140413.2041)

Instead I get a 32767 x 39 pixel image after a couple of minutes of processing, with a warning

dot: graph is too large for cairo-renderer bitmaps. Scaling by 0.048878 to fit

that suggests the image may not be very useful ;)

I've seen an error like this before somewhere (on my Jenkins Windows machine?), but I don't remember what I did about it.

kamakazikamikaze commented 7 years ago

dot - graphviz version 2.36.0 (20140111.2315)

I'll see what I need to do in order to upgrade. I'll report back when I've finished and have run it again!

(Edit: By the way, I have XDot installed via pip as well)

kamakazikamikaze commented 7 years ago

Alright, version 2.38.0 doesn't have this issue. I guess that resolves this problem!

Sorry about that. I had Linux Mint 17.3 and didn't know that 18 had been out.

And yes . . . the image is useless with that much crap in it 😆

EDIT: Do the docs have a recommended Graphviz/Dot version mentioned anywhere? I don't recall seeing anything

mgedmin commented 7 years ago

No, the Graphviz version shouldn't matter, in theory.

I see Ubuntu 14.04 LTS has graphviz 2.36.0. I wonder if it's possible to find a quoting method that works in both versions...