Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-2067

CFEngine crashes on RHEL 7.1 with "Programming Error: Rlist value contains type f instead of expected scalar"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 3.12.0
    • Fix Version/s: 3.14.0, 3.12.2
    • Component/s: Evaluation
    • Labels:
      None

      Description

      On our new RHEL 7.1 server, CFEngine dies with a "Programming Error"
      while executing a `process_select` bundle::

               verbose: B: *****************************************************************
               verbose: B: BEGIN bundle service_do_if_process_count_anomaly( {'term','$(ganglia.gmond_servname)','/usr/sbin/gmond','$(ganglia.gmond_user)','0','1'})
               verbose: B: *****************************************************************
               verbose: V:     +  Private parameter: 'action' in scope 'service_do_if_process_count_anomaly' (type: s) in pass 1
               verbose: V:     +  Private parameter: 'name' in scope 'service_do_if_process_count_anomaly' (type: s) in pass 1
               verbose: V:     +  Private parameter: 'cmd' in scope 'service_do_if_process_count_anomaly' (type: s) in pass 1
               verbose: V:     +  Private parameter: 'owner' in scope 'service_do_if_process_count_anomaly' (type: s) in pass 1
               verbose: V:     +  Private parameter: 'min' in scope 'service_do_if_process_count_anomaly' (type: s) in pass 1
               verbose: V:     +  Private parameter: 'max' in scope 'service_do_if_process_count_anomaly' (type: s) in pass 1
               verbose: V: .........................................................
               verbose: V: BEGIN variables (pass 1)
               verbose: V: .........................................................
               verbose: V:     Computing value of "cname"
               verbose: C: .........................................................
               verbose: C: BEGIN classes / conditions (pass 1)
               verbose: C: .........................................................
               verbose: C:     +  Private class: do_term
               verbose: Observe process table with /bin/ps -eo user,pid,ppid,pgid,pcpu,pmem,vsz,ni,rss:9,nlwp,stime,etime,time,args
              rlist.c:81: Programming Error: Rlist value contains type f instead of expected scalar
      

      The following code reproduces the problem reliably. The issue seems
      to be related to undefined variables and/or with the characters $,
      (, ) in the process command name.

              body common control
              {
                    inputs => { "$(sys.workdir)/share/CoreBase/masterfiles/lib/3.7/stdlib.cf" };
                    bundlesequence => { "stdlib_common", "test" };
              }
      
              bundle agent test
              {
                methods:
                  "1" usebundle => service_do_if_process_count_anomaly('term','$(ganglia.gmond_servname)','/usr/sbin/gmond','$(ganglia.gmond_user)','0','1');
              }
      
      
              bundle agent service_do_if_process_count_anomaly(action, name, cmd, owner, min, max)
              {
                vars:
                    "cname"      string => canonify("$(name)");
      
                classes:
                    "do_kill"    expression => strcmp("kill",    "$(action)");
                    "do_term"    expression => strcmp("term",    "$(action)");
      
                processes:
                    "$(cmd)"
                    process_select => _service_command_and_owner("$(cmd)", "$(owner)"),
                    # define class `too_many_running_...` if there is more than $max processes running
                    process_count  => _service_process_count_in_range("$(name)", "$(min)", "$(max)");
              }
      
              body process_select _service_command_and_owner(cmd, owner)
              {
                    # match if both `command` and `process_owner` match the expressions below
                    process_result => "command.process_owner";
                    process_owner  => { "$(owner)" };
                    command        => ".*$(cmd).*";
              }
      
      
              body process_count _service_process_count_in_range(name, min, max)
              {
                    match_range          => irange("$(min)", "$(max)");
                    in_range_define      => { canonify("$(name)_up") };
                    out_of_range_define  => { canonify("$(name)_count_anomaly") };
              }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                olehermanse Ole Herman Schumacher Elgesem
                Reporter:
                riccardomurri Riccardo Murri
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel