Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

滥用for循环 #356

Open
pobearm opened this issue Feb 28, 2023 · 1 comment
Open

滥用for循环 #356

pobearm opened this issue Feb 28, 2023 · 1 comment

Comments

@pobearm
Copy link

pobearm commented Feb 28, 2023

// 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
Copy link

yudidi commented Jun 21, 2023

这怎么解决啊

yudidi referenced this issue in yudidi/supervisord Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants