Simplify/reduce ulimit info to file descriptors
@@ -88,28 +88,14 @@ func (a AcceptForwardedValue) Set(s string) error {
}
func (r *Run) Execute(args Args, config *config.Couper, logEntry *logrus.Entry) error {
- rlimits := map[string]int{
- "RLIMIT CPU": syscall.RLIMIT_CPU,
- "RLIMIT Data": syscall.RLIMIT_DATA,
- "RLIMIT CORE": syscall.RLIMIT_CORE,
- "RLIMIT AS": syscall.RLIMIT_AS,
- "RLIMIT Stack": syscall.RLIMIT_STACK,
- "RLIMIT FSIZE": syscall.RLIMIT_FSIZE,
- "RLIMIT Nofile": syscall.RLIMIT_NOFILE,
- }
- for key, value := range rlimits {
lim := syscall.Rlimit{}
- err := syscall.Getrlimit(value, &lim)
+ err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &lim)
if err != nil {
- logEntry.Infof("an error occured while retrieving '%s'", key)
- continue
- }
- if lim.Cur < 4096 {
- logEntry.Warnf("%s Current: %d, %s Max: %d", key, lim.Cur, key, lim.Max)
- continue
- }
- logEntry.Infof("%s Current: %d, %s Max: %d", key, lim.Cur, key, lim.Max)
+ logEntry.Warnf("ulimit: error retrieving file descriptor limit")
+ } else {
+ logEntry.Infof("ulimit: max open files: %d (hard limit: %d)", lim.Cur, lim.Max)
}
+
r.settingsMu.Lock()
*r.settings = *config.Settings
r.settingsMu.Unlock()
@@ -131,7 +117,7 @@ func (r *Run) Execute(args Args, config *config.Couper, logEntry *logrus.Entry)
// Some remapping due to flag set pre-definition
env.Decode(r.settings)
- err := r.settings.SetAcceptForwarded()
+ err = r.settings.SetAcceptForwarded()
if err != nil {
return err
}
