diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-11 17:35:58 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-11 17:35:58 +0000 |
commit | a99900534bc477b40a16cde38d3fe799c11c5ed1 (patch) | |
tree | 7055758602aeba614b2b3936d0ce7d37d93fd5a3 /src/libserver/worker_util.c | |
parent | c441c82c28b4e80d9380151fd894cb3b9a530e11 (diff) | |
download | rspamd-a99900534bc477b40a16cde38d3fe799c11c5ed1.tar.gz rspamd-a99900534bc477b40a16cde38d3fe799c11c5ed1.zip |
Enable core files limits for rspamd
Diffstat (limited to 'src/libserver/worker_util.c')
-rw-r--r-- | src/libserver/worker_util.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index ef2b88578..9733bda3f 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -423,16 +423,28 @@ rspamd_worker_set_limits (struct rspamd_main *rspamd_main, } } - if (cf->rlimit_maxcore != 0) { - rlmt.rlim_cur = (rlim_t) cf->rlimit_maxcore; - rlmt.rlim_max = (rlim_t) cf->rlimit_maxcore; + if (rspamd_main->cores_throttling) { + 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 set max core rlimit: %d, %s", - cf->rlimit_maxcore, + msg_warn_main ("cannot disable core: %s", strerror (errno)); } } + else { + if (cf->rlimit_maxcore != 0) { + rlmt.rlim_cur = (rlim_t) cf->rlimit_maxcore; + rlmt.rlim_max = (rlim_t) cf->rlimit_maxcore; + + if (setrlimit (RLIMIT_CORE, &rlmt) == -1) { + msg_warn_main ("cannot set max core rlimit: %d, %s", + cf->rlimit_maxcore, + strerror (errno)); + } + } + } } struct rspamd_worker * |