diff options
| author | Simon MacMullen <simon@lshift.net> | 2008-11-25 15:33:18 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@lshift.net> | 2008-11-25 15:33:18 +0000 |
| commit | b29f01db686f64f0e17b808c658a42312b92fb29 (patch) | |
| tree | 95ddd9a98b4ab15d794d7eb836777667530840f3 | |
| parent | 4221321beb122aa1e89bb49ad2ea65b02d666a00 (diff) | |
| download | rabbitmq-server-git-b29f01db686f64f0e17b808c658a42312b92fb29.tar.gz | |
Start memsup programmatically rather than starting as standard and then
killing it if we don't want it => doesn't mess up the banner on startup
| -rwxr-xr-x | scripts/rabbitmq-server | 2 | ||||
| -rw-r--r-- | src/rabbit_alarm.erl | 17 |
2 files changed, 11 insertions, 8 deletions
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server index fba2f02681..2d1bfa8fc7 100755 --- a/scripts/rabbitmq-server +++ b/scripts/rabbitmq-server @@ -66,7 +66,7 @@ exec erl \ -sasl sasl_error_logger '{file,"'${SASL_LOGS}'"}' \ -os_mon start_cpu_sup true \ -os_mon start_disksup false \ - -os_mon start_memsup true \ + -os_mon start_memsup false \ # See rabbit_alarm:start/0 -os_mon start_os_sup false \ -os_mon memsup_system_only true \ -os_mon system_memory_high_watermark 0.95 \ diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl index 5ba88a303a..e2f468b7fe 100644 --- a/src/rabbit_alarm.erl +++ b/src/rabbit_alarm.erl @@ -50,17 +50,15 @@ %%---------------------------------------------------------------------------- start() -> + ok = alarm_handler:add_alarm_handler(?MODULE), case os:type() of {unix, linux} -> %% memsup doesn't take account of buffers or cache when considering %% "free" memory - therefore on Linux we can get memory alarms %% very easily without any pressure existing on memory at all. %% Therefore we need to use our own simple memory monitor - - supervisor:terminate_child(os_mon_sup, memsup), - supervisor:delete_child(os_mon_sup, memsup), + rabbit:start_child(rabbit_linux_memory), - ok; _ -> %% The default memsup check interval is 1 minute, which is way too @@ -75,11 +73,16 @@ start() -> %% check has completed, i.e. after one minute. So if rabbit eats %% all the memory within the first minute after startup then we %% are out of luck. - + + %% Start memsup programmatically rather than via the rabbitmq-server + %% script. This is not quite the right thing to do as os_mon checks + %% to see if memsup is available before starting it, but as memsup + %% is available everywhere (even on VXWorks) it should be ok. + supervisor:start_child(os_mon_sup, {memsup, {memsup, start_link, []}, + permanent, 2000, worker, [memsup]}), ok = os_mon:call(memsup, {set_check_interval, ?MEMSUP_CHECK_INTERVAL}, infinity) - end, - ok = alarm_handler:add_alarm_handler(?MODULE). + end. stop() -> ok = alarm_handler:delete_alarm_handler(?MODULE). |
