Skip to content

Commit

Permalink
Serialize resolver Start and Stop
Browse files Browse the repository at this point in the history
Signed-off-by: Santhosh Manohar <[email protected]>
  • Loading branch information
Santhosh Manohar committed Nov 20, 2016
1 parent f36e733 commit afccf9c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ func (r *resolver) Start() error {
return fmt.Errorf("setting up IP table rules failed: %v", err)
}

// If the container goes down quickly after start resolver.Stop() can
// get called before Start() completes. Check if the socket is still
// valid before Activating the DNS server. This avoids a panic in dns
// libarary code because of missing nil check for interface's data.
// github.com/docker/docker/issues/28112
if r.conn == nil {
return fmt.Errorf("resolver udp socket invalid")
}
s := &dns.Server{Handler: r, PacketConn: r.conn}
r.server = s
go func() {
Expand Down

0 comments on commit afccf9c

Please sign in to comment.