Skip to content

Commit

Permalink
core: log every 5s while waiting for dependencies
Browse files Browse the repository at this point in the history
Helps to flush out deadlocks in the dependency graph
  • Loading branch information
phinze committed Aug 10, 2015
1 parent 1a44b42 commit 9cd8881
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package dag

import (
"fmt"
"log"
"sort"
"strings"
"sync"
"time"

"github.com/hashicorp/go-multierror"
)
Expand Down Expand Up @@ -197,8 +199,19 @@ func (g *AcyclicGraph) Walk(cb WalkFunc) error {
readyCh := make(chan bool)
go func(v Vertex, deps []Vertex, chs []<-chan struct{}, readyCh chan<- bool) {
// First wait for all the dependencies
for _, ch := range chs {
<-ch
for i, ch := range chs {
DepSatisfied:
for {
select {
case <-ch:
break DepSatisfied
case <-time.After(time.Second * 5):
log.Printf("[DEBUG] vertex %s, waiting for: %s",
VertexName(v), VertexName(deps[i]))
}
}
log.Printf("[DEBUG] vertex %s, got dep: %s",
VertexName(v), VertexName(deps[i]))
}

// Then, check the map to see if any of our dependencies failed
Expand Down

0 comments on commit 9cd8881

Please sign in to comment.