Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker can not delete endpoint when allocateNetwork fail #33470

Closed
Ace-Tang opened this issue Jun 1, 2017 · 1 comment
Closed

docker can not delete endpoint when allocateNetwork fail #33470

Ace-Tang opened this issue Jun 1, 2017 · 1 comment
Labels
area/networking kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.

Comments

@Ace-Tang
Copy link

Ace-Tang commented Jun 1, 2017

Description

when allocate network for a new container, after CreateEndpoint in daemon/containers_operations.go, docker will call ep.Join to join sandbox, in sbJoin function, according to logic now, it will update endpoint's sandbox info in datastore, if any step fail(in my position, it fails at allocate ports), it just set ep.sandboxID = "", but bot update this info into datastore.

update endpoint info with sanbox in function sbJoin

if err = n.getController().updateToStore(ep); err != nil {
         return err
  }

set ep.sandboxID="" in function sbJoin after any step fails

defer func() {
       if err != nil {
            ep.Lock()
            ep.sandboxID = ""
            ep.Unlock()
        }
  }()

Describe the results you received:
in my test-integration-cli, this problem cause stale endpoint leave in datastore.
for eg, a container named fail got this problem, and leave endpoint info in datastore, when i want to create a container with name fail, it will got this error

Error response from daemon: service endpoint with name fail already exists

my fix:

i modify my code in function sbJoin , it will fix my problem

defer func() {
       if err != nil {
            ep.Lock()
            ep.sandboxID = ""
            ep.Unlock()
+          if err := n.getController().updateToStore(ep); err != nil {
+               log.Warnf("updateToStore failed: %v", err)
           }
        }
  }()

I wonder if i am right , can someone help me

Output of docker version:
i do some modify in my docker, but allocate network logic not have lots different with moby

@cpuguy83 cpuguy83 added area/networking kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. labels Jun 1, 2017
@sam-thibault
Copy link
Contributor

This is an old issue. I will close it as stale.

@sam-thibault sam-thibault closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
Projects
None yet
Development

No branches or pull requests

3 participants