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

Commit e1c8da6

Browse files
Plugin initiated workflow might be stopped without panic
1 parent 94d5f38 commit e1c8da6

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

control/available_plugin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func (a *availablePlugin) Stop(r string) error {
236236
return a.client.Kill(r)
237237
}
238238

239-
// Kill assumes aplugin is not able to here a Kill RPC call
239+
// Kill assumes a plugin is not able to hear a Kill RPC call
240240
func (a *availablePlugin) Kill(r string) error {
241241
log.WithFields(log.Fields{
242242
"_module": "control-aplugin",
@@ -252,6 +252,7 @@ func (a *availablePlugin) Kill(r string) error {
252252
}).Debug("deleting available plugin package")
253253
os.RemoveAll(filepath.Dir(a.execPath))
254254
}
255+
255256
// If it's a streaming plugin, we need to signal the scheduler that
256257
// this plugin is being killed.
257258
if c, ok := a.client.(client.PluginStreamCollectorClient); ok {

control/plugin/client/grpc.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,8 @@ func (g *grpcClient) Killed() {
219219
}
220220

221221
func (g *grpcClient) Kill(reason string) error {
222-
223222
_, err := g.plugin.Kill(getContext(g.timeout), &rpc.KillArg{Reason: reason})
224223
g.conn.Close()
225-
g.Killed()
226224
if err != nil {
227225
return err
228226
}

scheduler/task.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,11 @@ func (t *task) stream() {
295295
}
296296
select {
297297
case <-t.killChan:
298+
t.Lock()
298299
t.state = core.TaskStopped
299-
break
300+
t.Unlock()
301+
done = true
302+
return
300303
case mts, ok := <-metricsChan:
301304
if !ok {
302305
metricsChan = nil

0 commit comments

Comments
 (0)