Skip to content

Commit 1c62ffa

Browse files
committed
Ensuring endpoint resources are freed even on delete failures
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 <abhi@docker.com>
1 parent 6426d1e commit 1c62ffa

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

endpoint.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ func (ep *endpoint) Delete(force bool) error {
822822
}
823823
}
824824

825-
if err = n.getController().deleteFromStore(ep); err != nil {
825+
if err = n.getController().deleteFromStore(ep); err != nil && !force {
826826
return err
827827
}
828828

sandbox.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (sb *sandbox) Statistics() (map[string]*types.InterfaceStatistics, error) {
182182
}
183183

184184
func (sb *sandbox) Delete() error {
185-
return sb.delete(false)
185+
return sb.delete(true)
186186
}
187187

188188
func (sb *sandbox) delete(force bool) error {

0 commit comments

Comments
 (0)