Skip to content

Commit

Permalink
Ensuring endpoint resources are freed even on delete failures
Browse files Browse the repository at this point in the history
Came across a code path where we might not be releasing ip
address assigned to an endpoint if we have a failure with
deleteEndpoint. Even if there is a failure it is better to
release the resource rather than holding them. This might
lead to issues where ip never gets released even though
the container has exited and the only way of recovery is a
reload.

Signed-off-by: Abhinandan Prativadi <[email protected]>
  • Loading branch information
abhi committed Jul 28, 2017
1 parent 6426d1e commit 1c62ffa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ func (ep *endpoint) Delete(force bool) error {
}
}

if err = n.getController().deleteFromStore(ep); err != nil {
if err = n.getController().deleteFromStore(ep); err != nil && !force {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (sb *sandbox) Statistics() (map[string]*types.InterfaceStatistics, error) {
}

func (sb *sandbox) Delete() error {
return sb.delete(false)
return sb.delete(true)
}

func (sb *sandbox) delete(force bool) error {
Expand Down

0 comments on commit 1c62ffa

Please sign in to comment.