Forum: Cfengine Help
Subject: process matching rsize not working as expected
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,16840,16840#msg-16840

To combat the current memory leaks I created a promise to kill cf3 procs if 
they use too much memory.  This seems to work fine on Linux hosts but triggers 
unexpectedly on Solaris hosts.


bash-3.00# !ps
ps -eo rss,args|grep cf-
5488 /var/cfengine/bin/cf-monitord
2984 /var/cfengine/bin/cf-serverd
1368 grep cf-
2736 /var/cfengine/bin/cf-execd


It is my understanding that the above numbers are in kilobytes.  Below is the 
policy.  So the current processes are below the limits.  Yet when I run this 
bundle the processes are killed.  Have I made an error?


bash-3.00# cf-agent -Ib monitor
 >> Using command line specified bundlesequence
 !! Matched:     root 29663     1   0 10:17:16 ?           0:00 
/var/cfengine/bin/cf-monitord
 -> Signalled 'kill' (9) to observed process match '29663'
 !! Matched:     root 29674     1   0 10:17:26 ?           0:00 
/var/cfengine/bin/cf-serverd
 -> Signalled 'kill' (9) to observed process match '29674'
 !! Matched:     root 29682     1   0 10:17:35 ?           0:00 
/var/cfengine/bin/cf-execd
 -> Signalled 'kill' (9) to observed process match '29682'



    vars:

        "monitor_mem" int => "900000",
        comment => "Cf-monitord resident memory high limit.";

        "server_mem" int => "5800",
        comment => "Cf-serverd resident memory high limit.";

        "exec_mem" int => "120000",
        comment => "Cf-execd resident memory high limit.";

    processes:

        ".*?cf-monitord"
            process_select => memleak(".*?cf-monitord","${monitor_mem}"),
            signals => { "kill" },
            comment => "Stop if leaking too much memory.";

        ".*?cf-serverd"
            process_select => memleak(".*?cf-serverd","${server_mem}"),
            signals => { "kill" },
            comment => "Stop if leaking too much memory.";

        ".*?cf-execd"
            process_select => memleak(".*?cf-execd","${exec_mem}"),
            signals => { "kill" },
            comment => "Stop if leaking too much memory.";
....

body process_select memleak(c,s) {
    rsize => irange("0","${s}");
    command => "${c}";
    process_result => "command.!rsize";
}



_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to