diff --git a/lattice b/lattice index 36f453c1e..28c2313ec 160000 --- a/lattice +++ b/lattice @@ -1 +1 @@ -Subproject commit 36f453c1ea3bf86c546a8ad4a88f2a926724d683 +Subproject commit 28c2313ecfcd7e083d42d4e409483e968b4c421b diff --git a/server/server.go b/server/server.go index 291c986e1..530e4102a 100644 --- a/server/server.go +++ b/server/server.go @@ -24,6 +24,7 @@ import ( "context" "crypto/tls" "io" + "io/ioutil" "log" "math/rand" "net" @@ -31,6 +32,7 @@ import ( "os/signal" "runtime" "strconv" + "strings" "sync" "syscall" "time" @@ -152,6 +154,20 @@ func (m *Command) Start() (err error) { return errors.Wrap(err, "setting up server") } + if runtime.GOOS == "linux" { + result, err := ioutil.ReadFile("/proc/sys/vm/max_map_count") + if err != nil { + m.logger.Printf("Tried unsuccessfully to check system mmap limit: %v", err) + } else { + sysMmapLimit, err := strconv.ParseUint(strings.TrimSuffix(string(result), "\n"), 10, 64) + if err != nil { + m.logger.Printf("Tried unsuccessfully to check system mmap limit: %v", err) + } else if m.Config.MaxMapCount > sysMmapLimit { + m.logger.Printf("WARNING: Config max map limit (%v) is greater than current system limits (%v)", m.Config.MaxMapCount, sysMmapLimit) + } + } + } + // Set up networking (i.e. gossip) err = m.setupNetworking() if err != nil {