server: Set rLimit properly to the max. (#1676)

4000 is too small to handle 500 go-routines.

Fixes #1666
This commit is contained in:
Harshavardhana 2016-05-18 11:34:24 -07:00
parent 2da34e4668
commit b69a97aed4

View File

@ -29,9 +29,10 @@ func setMaxOpenFiles() error {
if err != nil {
return err
}
// Safe limit to be set on all platforms.
rLimit.Max = 4000
rLimit.Cur = 4000
// Set the current limit to Max, it is usually around 4096.
// TO increate this limit further user has to manually edit
// `/etc/security/limits.conf`
rLimit.Cur = rLimit.Max
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {
return err