From: Sven Schöling Date: Mon, 4 Mar 2019 15:43:35 +0000 (+0100) Subject: task_server.pl: Speicherlimit beachten X-Git-Tag: release-3.5.4~41 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=bc2b5fe6f8ceae8fd4135c0e44a5329cc22edfca;p=kivitendo-erp.git task_server.pl: Speicherlimit beachten (cherry picked from commit 7fcf2ca9960d160419aa89824cb4fb3a25188ad9) --- 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 {