mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Network disconnect: log rather than error on gateway update
During a network disconnect, log rather than returning an error
if it's not possible to set up a new gateway.
This restores the behaviour from before commit 53390f8 ("Put
clearNetworkResources() inline in its only caller"). It's not
ideal, but by the time new gateways are selected the old
endpoint has been disconnected - and nothing puts things back.
Until that's cleaned up, a broken state is inevitable, but
letting endpoint deletion complete means the container can
be restarted or re-connected to the network without a zombie
endpoint causing further issues.
Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
@@ -745,10 +745,12 @@ func (ep *Endpoint) Leave(ctx context.Context, sb *Sandbox) error {
|
||||
|
||||
func (ep *Endpoint) sbLeave(ctx context.Context, sb *Sandbox, n *Network, force bool) error {
|
||||
ctx = log.WithLogger(ctx, log.G(ctx).WithFields(log.Fields{
|
||||
"nid": n.ID(),
|
||||
"nid": stringid.TruncateID(n.ID()),
|
||||
"net": n.Name(),
|
||||
"eid": ep.ID(),
|
||||
"eid": epShortId(ep),
|
||||
"ep": ep.Name(),
|
||||
"sid": stringid.TruncateID(sb.ID()),
|
||||
"cid": stringid.TruncateID(sb.ContainerID()),
|
||||
}))
|
||||
|
||||
sb.mu.Lock()
|
||||
@@ -829,7 +831,13 @@ func (ep *Endpoint) sbLeave(ctx context.Context, sb *Sandbox, n *Network, force
|
||||
if needNewGwEp {
|
||||
gwepAfter4, gwepAfter6 = sb.getGatewayEndpoint()
|
||||
if err := sb.updateGateway(gwepAfter4, gwepAfter6); err != nil {
|
||||
return fmt.Errorf("updating gateway endpoint: %w", err)
|
||||
// Don't return an error here without adding proper rollback of the work done above.
|
||||
// See https://github.com/moby/moby/issues/51578
|
||||
log.G(ctx).WithFields(log.Fields{
|
||||
"gw4": epShortId(gwepAfter4),
|
||||
"gw6": epShortId(gwepAfter6),
|
||||
"error": err,
|
||||
}).Warn("Configuring gateway after network disconnect")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user