Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libnetwork: processEndpointDelete: Fix deadlock between getSvcRecords…
… and processEndpointDelete We had some hosts with quite a bit of cycling containers that ocassionally causes docker daemons to lock up. Most prominently `docker run` commands do not respond and nothing happens anymore. Looking at the stack trace the following is at least likely sometimes a cause to that: Two goroutines g0 and g1 can race against each other: * (g0) 1. getSvcRecords is called and calls (*network).Lock() --> Network is locked. * (g1) 2. processEndpointDelete is called, and calls (*controller).Lock() --> Controller is locked * (g1) 3. processEndpointDelete tries (*network).ID() which calls (*network).Lock(). * (g0) 4. getSvcRecords calls (*controller).Lock(). 3./4. are deadlocked against each other since the other goroutine holds the lock they need. References https://github.com/moby/libnetwork/blob/b5dc37037049d9b9ef68a3c4611e5eb1b35dd2af/network.go Signed-off-by: Steffen Butzer <[email protected]> (cherry picked from commit 7c97896747726554165480d102d9e46c54334cba) Signed-off-by: Cory Snider <[email protected]>
- Loading branch information