From bc2b5fe6f8ceae8fd4135c0e44a5329cc22edfca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 4 Mar 2019 16:43:35 +0100 Subject: [PATCH] task_server.pl: Speicherlimit beachten (cherry picked from commit 7fcf2ca9960d160419aa89824cb4fb3a25188ad9) --- config/kivitendo.conf.default | 10 ++++++++-- scripts/task_server.pl | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config/kivitendo.conf.default b/config/kivitendo.conf.default index 219896c4d..0715dc087 100644 --- a/config/kivitendo.conf.default +++ b/config/kivitendo.conf.default @@ -80,8 +80,14 @@ default_manager = german # processes). If either limit is reached at the end of the request # then the kivitendo process will exit. # -# This only makes sense when running under FCGI. The FCGI manager will -# then automatically start a new process. +# This only applies for processes under FCGI and the task manager. +# For CGI configurations the process will be terminated after each request +# regardless of this setting. +# +# Note: this will only terminate processes with too high memory consumption. It +# is assumed that an external managing service will start new instances. For +# FCGI this will usually be apache or the wrapper scripts for nginx, for the +# task server this will have to be the system manager. # # Numbers can be postfixed with KB, MB, GB. If no number is given or # the number is 0 then no checking will be performed. diff --git a/scripts/task_server.pl b/scripts/task_server.pl index f11859b2b..2f3339ccb 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -25,6 +25,7 @@ use SL::Auth; use SL::DBUpgrade2; use SL::DB::AuthClient; use SL::DB::BackgroundJob; +use SL::Dispatcher; use SL::BackgroundJob::ALL; use SL::Form; use SL::Helper::DateTime; @@ -331,6 +332,10 @@ sub gd_run { clean_before_sleeping(); + if (SL::Dispatcher::_memory_usage_is_too_high()) { + return; + } + my $seconds = 60 - (localtime)[0]; if (!eval { $SIG{'ALRM'} = sub { -- 2.20.1