]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Print limit values on start of the worker
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Mar 2019 17:56:50 +0000 (17:56 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Mar 2019 17:56:50 +0000 (17:56 +0000)
src/libserver/protocol.c
src/libserver/worker_util.c

index 2a9cc605a390346f4d00619b57679b2c309b8646..23690f45a9eac74c99283c518539e4a42414338c 100644 (file)
@@ -1328,7 +1328,7 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg,
                msg_notice_task (
                                "regexp statistics: %ud pcre regexps scanned, %ud regexps matched,"
                                " %ud regexps total, %ud regexps cached,"
-                               " %HL bytes scanned using pcre, %HL bytes scanned total",
+                               " %HL scanned using pcre, %HL scanned total",
                                restat->regexp_checked,
                                restat->regexp_matched,
                                restat->regexp_total,
index 827dc7fbbdd893655692f68c7b0e1f9e741a2e70..a3601621fb72b5dba583dd0690dd2d1f9b2eaeb4 100644 (file)
@@ -553,14 +553,27 @@ rspamd_worker_set_limits (struct rspamd_main *rspamd_main,
                                        (guint64) rlmt.rlim_max);
                }
        }
+       else {
+               /* Just report */
+               if (getrlimit (RLIMIT_NOFILE, &rlmt) == -1) {
+                       msg_warn_main ("cannot get max files rlimit: %HL, %s",
+                                       cf->rlimit_maxcore,
+                                       strerror (errno));
+               }
+               else {
+                       msg_info_main ("use system max file descriptors limit: %HL cur and %HL max",
+                                       (guint64) rlmt.rlim_cur,
+                                       (guint64) rlmt.rlim_max);
+               }
+       }
 
        if (rspamd_main->cores_throttling) {
-               msg_info_main ("disable core files for the new worker, as limits are reached");
+               msg_info_main ("disable core files for the new worker as limits are reached");
                rlmt.rlim_cur = 0;
                rlmt.rlim_max = 0;
 
                if (setrlimit (RLIMIT_CORE, &rlmt) == -1) {
-                       msg_warn_main ("cannot disable core: %s",
+                       msg_warn_main ("cannot disable core dumps: error when setting limits: %s",
                                        strerror (errno));
                }
        }
@@ -570,7 +583,7 @@ rspamd_worker_set_limits (struct rspamd_main *rspamd_main,
                        rlmt.rlim_max = (rlim_t) cf->rlimit_maxcore;
 
                        if (setrlimit (RLIMIT_CORE, &rlmt) == -1) {
-                               msg_warn_main ("cannot set max core rlimit: %HL, %s",
+                               msg_warn_main ("cannot set max core size limit: %HL, %s",
                                                cf->rlimit_maxcore,
                                                strerror (errno));
                        }
@@ -579,26 +592,40 @@ rspamd_worker_set_limits (struct rspamd_main *rspamd_main,
                        memset (&rlmt, 0, sizeof (rlmt));
 
                        if (getrlimit (RLIMIT_CORE, &rlmt) == -1) {
-                               msg_warn_main ("cannot get max core rlimit: %HL, %s",
+                               msg_warn_main ("cannot get max core size rlimit: %HL, %s",
                                                cf->rlimit_maxcore,
                                                strerror (errno));
                        }
                        else {
                                if (rlmt.rlim_cur != cf->rlimit_maxcore ||
                                        rlmt.rlim_max != cf->rlimit_maxcore) {
-                                       msg_warn_main ("setting of limits was unsuccessful: %HL was wanted, "
+                                       msg_warn_main ("setting of core file limits was unsuccessful: "
+                                                                  "%HL was wanted, "
                                                                   "but we have %HL cur and %HL max",
                                                        cf->rlimit_maxcore,
                                                        (guint64) rlmt.rlim_cur,
                                                        (guint64) rlmt.rlim_max);
                                }
                                else {
-                                       msg_info_main ("set core file limit: %HL cur and %HL max",
+                                       msg_info_main ("set max core size limit: %HL cur and %HL max",
                                                        (guint64) rlmt.rlim_cur,
                                                        (guint64) rlmt.rlim_max);
                                }
                        }
                }
+               else {
+                       /* Just report */
+                       if (getrlimit (RLIMIT_CORE, &rlmt) == -1) {
+                               msg_warn_main ("cannot get max core size limit: %HL, %s",
+                                               cf->rlimit_maxcore,
+                                               strerror (errno));
+                       }
+                       else {
+                               msg_info_main ("use system max core size limit: %HL cur and %HL max",
+                                               (guint64) rlmt.rlim_cur,
+                                               (guint64) rlmt.rlim_max);
+                       }
+               }
        }
 }