From 971f6a63fd95dc48bc726cace19b242a7f5dcd42 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sun, 31 Aug 2014 14:43:06 +0100 Subject: [PATCH] Turns out one OS thread isn't enough --- weaver/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/weaver/main.go b/weaver/main.go index 174f9f93..7edc2268 100644 --- a/weaver/main.go +++ b/weaver/main.go @@ -46,7 +46,13 @@ func main() { log.SetPrefix(weave.Protocol + " ") log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds) - runtime.GOMAXPROCS(runtime.NumCPU()) + procs := runtime.NumCPU() + // packet sniffing can block an OS thread, so we need one thread + // for that plus at least one more. + if procs < 2 { + procs = 2 + } + runtime.GOMAXPROCS(procs) var ( ifaceName string