At my company, we use Graphviz to layout various graphs, including some data flow graphs to show how variables are being used across a number of scripts.
We’ve noticed that in some scenarios, it will simply crash when it tries to layout certain graphs. Checking a debug build of 9.0 (which is the version we’re currently using), it turns out that transpose_step fails the assertion ND_order(v) < ND_order(w), since both nodes have order 0.
After adding a bunch of debug output and attempting to trace through the bug, it looks to me like the issue is that flat_reorder never adds nodes to temprank if local_in_cnt != 0 for a node - but once it actually goes to set ND_order for the rank, it assumes all of the nodes have been added to temprank.
I also downloaded a debug build of 16.0, and here it asserts an out-of-bounds access. Glancing at the code, the fundamental issue appears to be the same, and it’s just being detected consistently in flat_reorder because 16.0 does bounds checking. However, I have not done any debugging in this version of the code yet, since I don’t have it building locally yet (that’s the next thing I’ll be looking at).
It feels like it should be safe to just stop processing that rank if a node is skipped, but I’m not entirely confident if that’s the best move, or if it’s better to try to work with what can be done. Skipping the rank makes test_2368 in the 9.0 test suite pass instead of resulting in an expected failure, but I can’t quite tell if that’s indicative of an actual issue or not.
Here’s the graph, reduced as much as I could without changing the location of the crash in 9.0:
digraph G {
graph[ordering = "in"];
node8->node153
node211->node8
node221->node8
node12->node153
node12->node205
node91->node14 // possibly not needed
node211->node22
node48->node205
node91->node48 // possibly not needed
node118->node48
node51->node221
node118->node51
node72->node221 // possibly not needed
node8->node205
subgraph group0 {
cluster=true;
node8
node12
node14 // possibly not needed
node22
node48
node51
node72 // possibly not needed
node91 // possibly not needed
node118
node153
node205
node211
node221
}
}
I’ve added comments to the lines that I can still remove and see a crash, but 9.0 crashes or asserts in a different place when I do - so I left those in while doing my testing to be 100% certain I wasn’t suddenly looking at a different bug. But as I mentioned above, I suspect this is really the same issue in flat_reorder with or without those lines.