Skip to content

Commit

Permalink
Merge pull request #253 from mackerelio/fix-gomaxprocs-1
Browse files Browse the repository at this point in the history
fix GOMAXPROCS to 1 for avoiding rare panics
  • Loading branch information
Songmu committed Jul 13, 2016
2 parents cd15cd9 + a3eae65 commit add9048
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os/signal"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"syscall"
Expand Down Expand Up @@ -38,6 +39,12 @@ func (r *roleFullnamesFlag) Set(input string) error {
var logger = logging.GetLogger("main")

func main() {
// although the possibility is very low, mackerel-agent may panic because of
// a race condition in multi-threaded environment on some OS/Arch.
// So fix GOMAXPROCS to 1 just to be safe.
if os.Getenv("GOMAXPROCS") == "" {
runtime.GOMAXPROCS(1)
}
cli.Run(os.Args[1:])
}

Expand Down

0 comments on commit add9048

Please sign in to comment.