The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8009

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Otherwise trying to immediately start dnsmasq again can result in socket binding errors.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 23694b750d164369ece64c402f36a76358d2d957 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Fri, 9 Oct 2020 17:19:44 +0100
Subject: [PATCH] lxd/dnsmasq: Adds 100ms sleep to successful Kill() to allow
 sockets to be released by OS

Otherwise trying to immediately start dnsmasq again can result in socket 
binding errors.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/dnsmasq/dnsmasq.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lxd/dnsmasq/dnsmasq.go b/lxd/dnsmasq/dnsmasq.go
index 90c222ae66..d8491c2572 100644
--- a/lxd/dnsmasq/dnsmasq.go
+++ b/lxd/dnsmasq/dnsmasq.go
@@ -8,6 +8,7 @@ import (
        "os"
        "strings"
        "sync"
+       "time"
 
        "github.com/lxc/lxd/lxd/project"
        "github.com/lxc/lxd/shared"
@@ -95,7 +96,8 @@ func Kill(name string, reload bool) error {
                return fmt.Errorf("Unable to kill dnsmasq: %s", err)
        }
 
-       // Cleanup
+       time.Sleep(100 * time.Millisecond) // Give OS time to release sockets.
+
        return nil
 }
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to