-
Notifications
You must be signed in to change notification settings - Fork 179
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
Issue 2348 #2349
Issue 2348 #2349
Conversation
sqle/driver/plugin_manager.go
Outdated
|
||
// 退出进程 | ||
func KillProcess(process *os.Process) error { | ||
err := process.Signal(syscall.SIGTERM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个方式可能无法终止假死的进程,建议等待一段时间,如果还没有退出,就用kill -9兜底
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2秒后若不能成功退出插件进程,则直接process.kill()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err := process.Signal(syscall.SIGTERM) 这里如果卡住没有退出,是进不去case <-doneChan.C 这个case的,也就是2秒的定时不起作用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
process.Signal(syscall.SIGTERM)不会卡主,这里仅是向进程发送一个退出的信号,并不等待结果,process.Wait()才会阻塞
sqle/driver/plugin_manager.go
Outdated
log.NewEntry().Warnf("get plugin %s process failed, error: %v", pluginPidFilePath, err) | ||
} | ||
if process != nil { | ||
err = KillProcess(process) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
极端情况下如果有多个插件需要kill,每个插件等待2秒,会拖慢sqle的启动速度,建议做成多个插件并发kill。参考使用waitgroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已改用waitgroup形式
commit信息不规范,切换分支,pr移至#2447 |
关联的 issue
#2348
描述你的变更
sqle启动插件逻辑,新增记录插件pid文件,kill残留插件进程逻辑
确认项(pr提交后操作)
Tip
请在指定复审人之前,确认并完成以下事项,完成后✅
not_compatible
need_update_doc