ochinchina/supervisord

滥用for循环

pobearm opened this issue · 1 comments

// check if the process is running or not
func (p *Process) isRunning() bool {
	if p.cmd != nil && p.cmd.ProcessState == nil && p.cmd.Process != nil {
		if runtime.GOOS == "windows" {
			proc, err := os.FindProcess(p.cmd.Process.Pid)
			log.Info("pid: ", p.cmd.Process.Pid, " err: ", err, " porc: ", proc == nil)
			return proc != nil && err == nil
		}
		return p.cmd.Process.Signal(syscall.Signal(0)) == nil
	}
	return false
}

在这个方法中, 加一行log, 你会惊奇的发现日志刷爆了, 看了一下代码, 开了好几个goruntine + for 循环, 疯狂的调用这个方法.

yudidi commented

这怎么解决啊