Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
agent: clean up proxy process if start sandbox failed
Browse files Browse the repository at this point in the history
Otherwise we'll leave kata-proxy process dangling around forever.

Fixes: #759

Signed-off-by: Peng Tao <[email protected]>
  • Loading branch information
bergwolf committed Sep 21, 2018
1 parent 35d3c0b commit 0ddf99d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions virtcontainers/kata_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,12 @@ func (k *kataAgent) startSandbox(sandbox *Sandbox) error {
return err
}

defer func() {
if err != nil {
k.proxy.stop(k.state.ProxyPid)
}
}()

hostname := sandbox.config.Hostname
if len(hostname) > maxHostnameLen {
hostname = hostname[:maxHostnameLen]
Expand All @@ -586,10 +592,10 @@ func (k *kataAgent) startSandbox(sandbox *Sandbox) error {
if err != nil {
return err
}
if err := k.updateInterfaces(interfaces); err != nil {
if err = k.updateInterfaces(interfaces); err != nil {
return err
}
if _, err := k.updateRoutes(routes); err != nil {
if _, err = k.updateRoutes(routes); err != nil {
return err
}

Expand Down

0 comments on commit 0ddf99d

Please sign in to comment.