From 9cd88810f4683489da843736d344cfa1d49a1e44 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Fri, 7 Aug 2015 14:48:13 -0500 Subject: [PATCH] core: log every 5s while waiting for dependencies Helps to flush out deadlocks in the dependency graph --- dag/dag.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dag/dag.go b/dag/dag.go index 602cacd99..b609ac707 100644 --- a/dag/dag.go +++ b/dag/dag.go @@ -2,9 +2,11 @@ package dag import ( "fmt" + "log" "sort" "strings" "sync" + "time" "github.com/hashicorp/go-multierror" ) @@ -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