Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Plugin initiated workflow might be stopped without panic
Browse files Browse the repository at this point in the history
  • Loading branch information
IzabellaRaulin committed Apr 5, 2017
1 parent 94d5f38 commit e1c8da6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion control/available_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (a *availablePlugin) Stop(r string) error {
return a.client.Kill(r)
}

// Kill assumes aplugin is not able to here a Kill RPC call
// Kill assumes a plugin is not able to hear a Kill RPC call
func (a *availablePlugin) Kill(r string) error {
log.WithFields(log.Fields{
"_module": "control-aplugin",
Expand All @@ -252,6 +252,7 @@ func (a *availablePlugin) Kill(r string) error {
}).Debug("deleting available plugin package")
os.RemoveAll(filepath.Dir(a.execPath))
}

// If it's a streaming plugin, we need to signal the scheduler that
// this plugin is being killed.
if c, ok := a.client.(client.PluginStreamCollectorClient); ok {
Expand Down
2 changes: 0 additions & 2 deletions control/plugin/client/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,8 @@ func (g *grpcClient) Killed() {
}

func (g *grpcClient) Kill(reason string) error {

_, err := g.plugin.Kill(getContext(g.timeout), &rpc.KillArg{Reason: reason})
g.conn.Close()
g.Killed()
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion scheduler/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,11 @@ func (t *task) stream() {
}
select {
case <-t.killChan:
t.Lock()
t.state = core.TaskStopped
break
t.Unlock()
done = true
return
case mts, ok := <-metricsChan:
if !ok {
metricsChan = nil
Expand Down

0 comments on commit e1c8da6

Please sign in to comment.