Skip to content

Commit

Permalink
core: dag errors should cascade to all descendents
Browse files Browse the repository at this point in the history
We weren't marking skipped nodes as failing, so any
grandchild-and-deeper dependencies would still evaluate.

For example:

    A -> B -> C -> D

If B failed, C would be skipped, but D would still be evaluated.

This fixes the behavior so C, D, and any further descendents will all be
skipped when B fails.

Addresses crashing aspect of #2955 and likely a lot of other confusing
failure modes.
  • Loading branch information
phinze committed Aug 7, 2015
1 parent f238e25 commit 9d8b386
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func (g *AcyclicGraph) Walk(cb WalkFunc) error {
defer errLock.Unlock()
for _, dep := range deps {
if errMap[dep] {
errMap[v] = true
readyCh <- false
return
}
Expand Down
4 changes: 3 additions & 1 deletion dag/dag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ func TestAcyclicGraphWalk_error(t *testing.T) {
g.Add(1)
g.Add(2)
g.Add(3)
g.Add(4)
g.Connect(BasicEdge(4, 3))
g.Connect(BasicEdge(3, 2))
g.Connect(BasicEdge(3, 1))
g.Connect(BasicEdge(2, 1))

var visits []Vertex
var lock sync.Mutex
Expand Down

0 comments on commit 9d8b386

Please sign in to comment.