Intermittent crash with dot layout
The attached dot file crashes about half the time with dot:
"C:\Program Files\Graphviz 2.44.1\bin\dot.exe" ClusterCallButterfly-_git_uploadpack.dot -Txdot1.2 -o tst2.dot & echo %errorLevel%
-1073741819
How can I get dot to work consistently?
Graphviz is version 2.44.1. The intermittent crashing is happening on both mac and windows and with other dot files. I've been debugging from a custom program (gvlayout.cpp) that calls graphviz, but the crash happens with the shipped version of dot too (as shown above).
It looks like crash depends on the dictionary order. In collapse_sets (graphviz/lib/dotgen/rank.c) if the rank_set_class returns 0 first, then collapse_sets is called recursively. In the second call, rank_set_class returns 7 and make_new_cluster is called with the same subgraph pointer that is stored in the ccs variable of doDot (graphviz/lib/dotgen/dotinit.c). The ccs variable is cleared in dot_cleanup_graph at the end of doDot, so the subgraph data pointer is null in place_flip_graph_label (graphviz/lib/common/postproc.c) causing a crash with this stack trace:
gvlayout.exe!place_flip_graph_label(Agraph_s * g) Line 706 C
gvlayout.exe!place_flip_graph_label(Agraph_s * g) Line 727 C
gvlayout.exe!gv_postprocess(Agraph_s * g, int allowTranslation) Line 613 C
gvlayout.exe!gvLayoutJobs(GVC_s * gvc, Agraph_s * g) Line 88 C
gvlayout.exe!main(int argc, char * * argv) Line 472 C++
And this exception: Exception thrown at 0x00007FF74D727ED0 in gvlayout.exe: 0xC0000005: Access violation reading location 0x0000000000000018
If the first call to rank_set_class from collapse_sets returns 7, then make_new_cluster does not share a subgraph pointer with ccs and the program runs successfully.
Here is output from visual studio debugger with some breakpoints printing out variable information. The first is from a crash and the second ran successfully (exact same input). In the crash output the pointer used by the second place_flip_graph_label call has already been cleared by set_data (graphviz/lib/cgraph/rec.c).
doDot(Agraph_s *) 0x0000024909e9ddf0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eafbb0 {name=0x0000024909eac260 "Agraphinfo_t" ...} } ...}
cccomps(Agraph_s *, int *, char *) line 675 (return) c_cnt=1 ccs=0x0000024909ea68a0 {0x0000024909e9e9f0 {base={tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x0000024909eafda0 {...} } ...}} ccs[0]=0x0000024909e9e9f0 {base={tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x0000024909eafda0 {name=0x0000024909e8a500 "_AG_datadict" ...} } ...}
'gvlayout.exe' (Win32): Loaded 'C:\Windows\System32\DWrite.dll'. Cannot find or open the PDB file.
collapse_sets(Agraph_s *, Agraph_s *) line 328 c=0 rg=0x0000024909e9ddf0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eafbb0 {name=0x0000024909eac260 "Agraphinfo_t" ...} } ...}
collapse_sets(Agraph_s *, Agraph_s *) line 328 c=7 rg=0x0000024909e9ddf0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eafbb0 {name=0x0000024909eac260 "Agraphinfo_t" ...} } ...}
make_new_cluster(Agraph_s *, Agraph_s *) g=0x0000024909e9ddf0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eafbb0 {name=0x0000024909eac260 "Agraphinfo_t" ...} } ...} subg=0x0000024909e9f3f0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eb0f00 {name=0x0000024909eac260 "Agraphinfo_t" ...} } ...}
gvlayout.exe!make_new_cluster
gvlayout.exe!collapse_cluster
gvlayout.exe!collapse_sets
gvlayout.exe!collapse_sets
gvlayout.exe!dot1_rank
gvlayout.exe!dot_rank
gvlayout.exe!dotLayout
gvlayout.exe!doDot
gvlayout.exe!dot_layout
gvlayout.exe!gvLayoutJobs
gvlayout.exe!main
[Inline Frame] gvlayout.exe!invoke_main
gvlayout.exe!__scrt_common_main_seh
kernel32.dll!00007ff893a57034
ntdll.dll!00007ff89511cec1
collapse_sets(Agraph_s *, Agraph_s *) line 328 c=7 rg=0x0000024909e9ddf0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eafbb0 {name=0x0000024909eac260 "Agraphinfo_t" ...} } ...}
dot_cleanup_graph(Agraph_s *) 0x0000024909e9e9f0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eb0d60 {name=0x0000024909eac260 "Agraphinfo_t" ...} } ...}
dot_cleanup_graph(Agraph_s *) 0x0000024909e9f3f0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eb0f00 {name=0x0000024909eac260 "Agraphinfo_t" ...} } ...}
set_data(Agobj_s *, Agrec_s *, int) obj=0x0000024909e9f3f0 {tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eb0f00 {name=0x0000024909eac260 "Agraphinfo_t" ...} } data=0x0000024909eb0490 {name=0x0000024909e897c0 "_AG_strdata" next=0x0000024909eafdd0 {name=0x0000024909e8a500 "_AG_datadict" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x0000024909e9e9f0 {tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eb0d60 {name=0x0000024909eac260 "Agraphinfo_t" ...} } data=0x0000024909eafe90 {name=0x0000024909e897c0 "_AG_strdata" next=0x0000024909eafda0 {name=0x0000024909e8a500 "_AG_datadict" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x0000024909e9f3f0 {tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x0000024909eb0490 {name=0x0000024909e897c0 "_AG_strdata" ...} } data=0x0000024909eafdd0 {name=0x0000024909e8a500 "_AG_datadict" next=0x0000024909eaf690 {name=0x0000024909eac320 "orig" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x0000024909e9f3f0 {tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x0000024909eafdd0 {name=0x0000024909e8a500 "_AG_datadict" ...} } data=0x0000024909eaf690 {name=0x0000024909eac320 "orig" next=0x0000024909eaf690 {name=0x0000024909eac320 "orig" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x0000024909e9e9f0 {tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x0000024909eafe90 {name=0x0000024909e897c0 "_AG_strdata" ...} } data=0x0000024909eafda0 {name=0x0000024909e8a500 "_AG_datadict" next=0x0000024909eafda0 {name=0x0000024909e8a500 "_AG_datadict" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x0000024909e9e9f0 {tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x0000024909eafda0 {name=0x0000024909e8a500 "_AG_datadict" ...} } data=0x0000000000000000 <NULL> mtflock=0
place_flip_graph_label(Agraph_s *) g=0x0000024909e9ddf0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x0000024909eafbb0 {name=0x0000024909eac260 "Agraphinfo_t" ...} } ...} g->base.data=0x0000024909eafbb0 {name=0x0000024909eac260 "Agraphinfo_t" next=0x0000024909ea61b0 {name=0x0000024909e897c0 "_AG_strdata" ...} }
place_flip_graph_label(Agraph_s *) g=0x0000024909e9f3f0 {base={tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x0000000000000000 <NULL> } desc=...} g->base.data=0x0000000000000000 <NULL>
Exception thrown at 0x00007FF74D727ED0 in gvlayout.exe: 0xC0000005: Access violation reading location 0x0000000000000018.
doDot(Agraph_s *) 0x000001a94e45fae0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e4718e0 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...}
cccomps(Agraph_s *, int *, char *) line 675 (return) c_cnt=1 ccs=0x000001a94e468710 {0x000001a94e4611e0 {base={tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x000001a94e472670 {...} } ...}} ccs[0]=0x000001a94e4611e0 {base={tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x000001a94e472670 {name=0x000001a94e448460 "_AG_datadict" ...} } ...}
'gvlayout.exe' (Win32): Loaded 'C:\Windows\System32\DWrite.dll'. Cannot find or open the PDB file.
collapse_sets(Agraph_s *, Agraph_s *) line 328 c=7 rg=0x000001a94e45fae0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e4718e0 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...}
make_new_cluster(Agraph_s *, Agraph_s *) g=0x000001a94e45fae0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e4718e0 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...} subg=0x000001a94e460660 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e472a90 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...}
gvlayout.exe!make_new_cluster
gvlayout.exe!collapse_cluster
gvlayout.exe!collapse_sets
gvlayout.exe!dot1_rank
gvlayout.exe!dot_rank
gvlayout.exe!dotLayout
gvlayout.exe!doDot
gvlayout.exe!dot_layout
gvlayout.exe!gvLayoutJobs
gvlayout.exe!main
[Inline Frame] gvlayout.exe!invoke_main
gvlayout.exe!__scrt_common_main_seh
kernel32.dll!00007ff893a57034
ntdll.dll!00007ff89511cec1
collapse_sets(Agraph_s *, Agraph_s *) line 328 c=0 rg=0x000001a94e45fae0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e4718e0 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...}
collapse_sets(Agraph_s *, Agraph_s *) line 328 c=7 rg=0x000001a94e45fae0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e4718e0 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...}
dot_cleanup_graph(Agraph_s *) 0x000001a94e4611e0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e472c30 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...}
dot_cleanup_graph(Agraph_s *) 0x000001a94e460960 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e472dd0 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...}
set_data(Agobj_s *, Agrec_s *, int) obj=0x000001a94e460960 {tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e472dd0 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } data=0x000001a94e4725e0 {name=0x000001a94e448ae0 "_AG_strdata" next=0x000001a94e4723a0 {name=0x000001a94e448460 "_AG_datadict" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x000001a94e4611e0 {tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e472c30 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } data=0x000001a94e471c20 {name=0x000001a94e448ae0 "_AG_strdata" next=0x000001a94e472670 {name=0x000001a94e448460 "_AG_datadict" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x000001a94e460960 {tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x000001a94e4725e0 {name=0x000001a94e448ae0 "_AG_strdata" ...} } data=0x000001a94e4723a0 {name=0x000001a94e448460 "_AG_datadict" next=0x000001a94e470da0 {name=0x000001a94e46dd90 "orig" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x000001a94e460960 {tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x000001a94e4723a0 {name=0x000001a94e448460 "_AG_datadict" ...} } data=0x000001a94e470da0 {name=0x000001a94e46dd90 "orig" next=0x000001a94e470da0 {name=0x000001a94e46dd90 "orig" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x000001a94e4611e0 {tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x000001a94e471c20 {name=0x000001a94e448ae0 "_AG_strdata" ...} } data=0x000001a94e472670 {name=0x000001a94e448460 "_AG_datadict" next=0x000001a94e472670 {name=0x000001a94e448460 "_AG_datadict" ...} } mtflock=0
set_data(Agobj_s *, Agrec_s *, int) obj=0x000001a94e4611e0 {tag={objtype=0 mtflock=0 attrwf=0 ...} data=0x000001a94e472670 {name=0x000001a94e448460 "_AG_datadict" ...} } data=0x0000000000000000 <NULL> mtflock=0
place_flip_graph_label(Agraph_s *) g=0x000001a94e45fae0 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e4718e0 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...} g->base.data=0x000001a94e4718e0 {name=0x000001a94e46e690 "Agraphinfo_t" next=0x000001a94e467ee0 {name=0x000001a94e448ae0 "_AG_strdata" ...} }
place_flip_graph_label(Agraph_s *) g=0x000001a94e460660 {base={tag={objtype=0 mtflock=1 attrwf=0 ...} data=0x000001a94e472a90 {name=0x000001a94e46e690 "Agraphinfo_t" ...} } ...} g->base.data=0x000001a94e472a90 {name=0x000001a94e46e690 "Agraphinfo_t" next=0x000001a94e4661a0 {name=0x000001a94e448460 "_AG_datadict" ...} }
The thread 0x740 has exited with code 0 (0x0).
The thread 0x1df8 has exited with code 0 (0x0).
The program '[4068] gvlayout.exe' has exited with code 0 (0x0).