Destroying the plugin if we can't connect to it

This commit is contained in:
Diptanu Choudhury
2016-02-04 13:53:30 -08:00
parent d24f089273
commit 5ea6b85e76
5 changed files with 43 additions and 0 deletions

View File

@@ -202,6 +202,10 @@ func (d *JavaDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, erro
}
executor, pluginClient, err := createExecutor(pluginConfig, d.config.LogOutput)
if err != nil {
d.logger.Println("[ERROR] error connecting to plugin so destroying plugin pid and user pid")
if e := destroyPlugin(id.PluginConfig.Pid, id.UserPid); e != nil {
d.logger.Printf("[ERROR] error destroying plugin and userpid: %v", e)
}
return nil, fmt.Errorf("error connecting to plugin: %v", err)
}