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

修复插件运行失败panic 导致agent 进程退出 #468

Merged
merged 1 commit into from
Jul 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions modules/agent/plugins/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ package plugins
import (
"bytes"
"encoding/json"
"github.com/open-falcon/falcon-plus/common/model"
"github.com/open-falcon/falcon-plus/modules/agent/g"
"github.com/toolkits/file"
"github.com/toolkits/sys"
"log"
"os/exec"
"path/filepath"
"syscall"
"time"

"github.com/open-falcon/falcon-plus/common/model"
"github.com/open-falcon/falcon-plus/modules/agent/g"
"github.com/toolkits/file"
"github.com/toolkits/sys"
)

type PluginScheduler struct {
Expand Down Expand Up @@ -80,7 +81,11 @@ func PluginRun(plugin *Plugin) {
var stderr bytes.Buffer
cmd.Stderr = &stderr
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
cmd.Start()
err := cmd.Start()
if err != nil {
log.Printf("[ERROR] plugin start fail, error: %s\n", err)
return
}
if debug {
log.Println("plugin started:", fpath)
}
Expand Down