actiontech/dtle

Possible blocking on waitCh

c0494133d4 opened this issue · 1 comments

func onError() {
    ...
    e.waitCh <- &drivers.ExitResult
}

waitCh is defined as

func newDtleTaskHandle() {
		waitCh:      make(chan *drivers.ExitResult, 1),
}

and read only once

func handleWait() {
	case result := <-handle.waitCh:
}

A concurrent call to onError might block on waitCh forever.

StopTask() vs DestroyTask()

  • 主动nomad job stop时,先调用StopTask再调用DestroyTask
  • 任务报错退出时,只调用DestroyTask

目前两者都调用了handle.Destroy(), 待review。