Created
January 30, 2022 22:04
-
-
Save dojci/ae2e1a10c1bbc87ecea2f7ba68baefc8 to your computer and use it in GitHub Desktop.
moby libnetwork overlay driver deadlock fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From dbfe4c30f0e2096fce3b7cbcfe388cf5a72e5247 Mon Sep 17 00:00:00 2001 | |
From: Martin Dojcak <martin.dojcak@lablabs.io> | |
Date: Sun, 30 Jan 2022 22:11:42 +0100 | |
Subject: [PATCH] libnetwork/overlay:fix join sandbox deadlock | |
--- | |
.../docker/libnetwork/drivers/overlay/peerdb.go | 14 ++------------ | |
1 file changed, 2 insertions(+), 12 deletions(-) | |
diff --git a/vendor/github.com/docker/libnetwork/drivers/overlay/peerdb.go b/vendor/github.com/docker/libnetwork/drivers/overlay/peerdb.go | |
index 58d70d04d8..ce568479a8 100644 | |
--- a/vendor/github.com/docker/libnetwork/drivers/overlay/peerdb.go | |
+++ b/vendor/github.com/docker/libnetwork/drivers/overlay/peerdb.go | |
@@ -242,12 +242,11 @@ func (d *driver) peerDbDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPM | |
// networkDB has already delivered some events of peers already available on remote nodes, | |
// these peers are saved into the peerDB and this function is used to properly configure | |
// the network sandbox with all those peers that got previously notified. | |
-// Note also that this method sends a single message on the channel and the go routine on the | |
-// other side, will atomically loop on the whole table of peers and will program their state | |
+// Note also that this method will atomically loop on the whole table of peers and will program their state | |
// in one single atomic operation. This is fundamental to guarantee consistency, and avoid that | |
// new peerAdd or peerDelete gets reordered during the sandbox init. | |
func (d *driver) initSandboxPeerDB(nid string) { | |
- d.peerInit(nid) | |
+ d.peerInitOp(nid) | |
} | |
type peerOperationType int32 | |
@@ -297,15 +296,6 @@ func (d *driver) peerOpRoutine(ctx context.Context, ch chan *peerOperation) { | |
} | |
} | |
-func (d *driver) peerInit(nid string) { | |
- callerName := caller.Name(1) | |
- d.peerOpCh <- &peerOperation{ | |
- opType: peerOperationINIT, | |
- networkID: nid, | |
- callerName: callerName, | |
- } | |
-} | |
- | |
func (d *driver) peerInitOp(nid string) error { | |
return d.peerDbNetworkWalk(nid, func(pKey *peerKey, pEntry *peerEntry) bool { | |
// Local entries do not need to be added | |
-- | |
2.34.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment