Skip to content

Commit

Permalink
Remove logging from timeout handler ✏️
Browse files Browse the repository at this point in the history
Logging in the timeout handler was added as part of #731 cuz it helped
us debug when the timeout handler didn't work as expected. Unfortunately
it looks like the logger we're using can't be used in multiple go
routines (uber-go/zap#99 may be related).
Removing this logging to fix #1124, hopefully can find a safe way to add
logging back in #1307.
  • Loading branch information
bobcatfish authored and tekton-robot committed Sep 15, 2019
1 parent 17c45ee commit ee5f2d0
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions pkg/reconciler/timeout_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ func backoffDuration(count uint, jf jitterFunc) time.Duration {
func (t *TimeoutSet) checkPipelineRunTimeouts(namespace string, pipelineclientset clientset.Interface) {
pipelineRuns, err := pipelineclientset.TektonV1alpha1().PipelineRuns(namespace).List(metav1.ListOptions{})
if err != nil {
t.logger.Errorf("Can't get pipelinerun list in namespace %s: %s", namespace, err)
return
}
for _, pipelineRun := range pipelineRuns.Items {
Expand All @@ -189,7 +188,6 @@ func (t *TimeoutSet) checkPipelineRunTimeouts(namespace string, pipelineclientse
func (t *TimeoutSet) CheckTimeouts(kubeclientset kubernetes.Interface, pipelineclientset clientset.Interface) {
namespaces, err := kubeclientset.CoreV1().Namespaces().List(metav1.ListOptions{})
if err != nil {
t.logger.Errorf("Can't get namespaces list: %s", err)
return
}
for _, namespace := range namespaces.Items {
Expand All @@ -203,7 +201,6 @@ func (t *TimeoutSet) CheckTimeouts(kubeclientset kubernetes.Interface, pipelinec
func (t *TimeoutSet) checkTaskRunTimeouts(namespace string, pipelineclientset clientset.Interface) {
taskruns, err := pipelineclientset.TektonV1alpha1().TaskRuns(namespace).List(metav1.ListOptions{})
if err != nil {
t.logger.Errorf("Can't get taskrun list in namespace %s: %s", namespace, err)
return
}
for _, taskrun := range taskruns.Items {
Expand Down Expand Up @@ -245,14 +242,12 @@ func (t *TimeoutSet) WaitPipelineRun(pr *v1alpha1.PipelineRun, startTime *metav1

func (t *TimeoutSet) waitRun(runObj StatusKey, timeout time.Duration, startTime *metav1.Time, callback func(interface{})) {
if startTime == nil {
t.logger.Errorf("startTime must be specified in order for a timeout to be calculated accurately for %s", runObj.GetRunKey())
return
}
if callback == nil {
callback = defaultFunc
}
runtime := time.Since(startTime.Time)
t.logger.Infof("About to start timeout timer for %s. started at %s, timeout is %s, running for %s", runObj.GetRunKey(), startTime.Time, timeout, runtime)
defer t.Release(runObj)
t.setTimer(runObj, timeout-runtime, callback)
}
Expand All @@ -267,24 +262,19 @@ func (t *TimeoutSet) waitRun(runObj StatusKey, timeout time.Duration, startTime
func (t *TimeoutSet) SetTaskRunTimer(tr *v1alpha1.TaskRun, d time.Duration) {
callback := t.taskRunCallbackFunc
if callback == nil {
t.logger.Errorf("attempted to set a timer for %q but no task run callback has been assigned", tr.Name)
return
}
t.setTimer(tr, d, callback)
}

func (t *TimeoutSet) setTimer(runObj StatusKey, timeout time.Duration, callback func(interface{})) {
finished := t.getOrCreateFinishedChan(runObj)
started := time.Now()
select {
case <-t.stopCh:
t.logger.Infof("stopping timer for %q", runObj.GetRunKey())
return
case <-finished:
t.logger.Infof("%q finished, stopping timer", runObj.GetRunKey())
return
case <-time.After(timeout):
t.logger.Infof("timer for %q has activated after %s", runObj.GetRunKey(), time.Since(started).String())
callback(runObj)
}
}

0 comments on commit ee5f2d0

Please sign in to comment.