From a7f01d238ecf17a7bb849f0ae4d37f5021e0e4ef Mon Sep 17 00:00:00 2001 From: Cory Snider Date: Wed, 18 Jun 2025 17:58:08 -0400 Subject: [PATCH] libnetwork: fix flaky Swarm service DNS When libnetwork receives a watch event for a driver table entry from NetworkDB it passes the event along to the interested driver. This code contains a subtle bug: update events from NetworkDB are passed along to the driver as Delete events! This bug was lying dormant as driver-table entries can only be added by the driver, not updated. Now that NetworkDB broadcasts an UpdateEvent to watchers if the entry is already known to the local NetworkDB, irrespective of whether the event received from the remote peer was a CREATE or UPDATE event, the bug is causing problems. Whenever a remote node replaces an entry in the overlay_peer_table but the intermediate delete state was not received by the local node, the new CREATE event would be translated to an UpdateEvent by NetworkDB and subsequently handled by the overlay driver as if the entry was deleted! Bubble table UPDATE events up to the network driver as Update events. Signed-off-by: Cory Snider --- libnetwork/agent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnetwork/agent.go b/libnetwork/agent.go index aee5dbd536..b7e7e26935 100644 --- a/libnetwork/agent.go +++ b/libnetwork/agent.go @@ -836,7 +836,7 @@ func (n *Network) handleDriverTableEvent(ev events.Event) { tname = event.Table key = event.Key value = event.Value - etype = driverapi.Delete + etype = driverapi.Update } d.EventNotify(etype, n.ID(), tname, key, value)