Forum: Cfengine Help Subject: Re: cf-agent segfaulting Author: msvob...@linkedin.com Link to topic: https://cfengine.com/forum/read.php?3,17904,17921#msg-17921
cf-promises looks happy. $ /var/cfengine/bin/cf-promises -f /var/cfengine/inputs/promises.cf -v cf3 Cfengine - autonomous configuration engine - commence self-diagnostic prelude cf3 ------------------------------------------------------------------------ cf3 Work directory is /var/cfengine cf3 Making sure that locks are private... cf3 Checking integrity of the state database cf3 Checking integrity of the module directory cf3 Checking integrity of the PKI directory cf3 Looking for a source of entropy in /var/cfengine/randseed cf3 Loaded /var/cfengine/ppkeys/localhost.priv cf3 Loaded /var/cfengine/ppkeys/localhost.pub cf3 No registered cfengine service, using default cf3 !!! System error for getservbyname: "Error 0" cf3 Setting cfengine default port to 5308 = 5308 cf3 Reference time set to Mon Aug 16 08:03:32 2010 cf3 Cfengine - 3.0.4 (C) Cfengine AS 2008- cf3 ------------------------------------------------------------------------ cf3 Host name is: xxxxxxxx cf3 Operating System Type is sunos cf3 Operating System Release is 5.10 cf3 Architecture = i86pc cf3 Using internal soft-class solarisx86 for host xxxxxxxxxx cf3 The time is now Mon Aug 16 08:03:32 2010 cf3 ------------------------------------------------------------------------ cf3 # Extended system discovery is only available in version Nova and above cf3 Additional hard class defined as: 32_bit cf3 Additional hard class defined as: sunos_5_10 cf3 Additional hard class defined as: sunos_i86pc cf3 Additional hard class defined as: sunos_i86pc_5_10 cf3 Additional hard class defined as: i386 cf3 Additional hard class defined as: i86pc cf3 GNU autoconf class from compile time: compiled_on_solaris2_10 cf3 Address given by nameserver: xxxxxxxxxxxx cf3 Interface 2: nge2 cf3 Adding alias loghost.. cf3 Interface 4: nge3 cf3 Trying to locate my IPv6 address cf3 Looking for environment from cf-monitor... cf3 Unable to detect environment from cfMonitord cf3 *********************************************************** cf3 Loading persistent classes cf3 *********************************************************** cf3 *********************************************************** cf3 Loaded persistent memory cf3 *********************************************************** cf3 > Parsing file /var/cfengine/inputs/promises.cf cf3 Initiate variable convergence... cf3 -> Checking common class promises... cf3 Executing and using module cf3 Activated classes: app_server cf3 Executing and using module cf3 Activated classes: ESV4 cf3 Activated classes: STG cf3 Initiate control variable convergence... cf3 > Parsing file /var/cfengine/inputs/cfengine_stdlib.cf cf3 > Parsing file /var/cfengine/inputs/cf-execd.cf cf3 > Parsing file /var/cfengine/inputs/cf-monitord.cf cf3 > Parsing file /var/cfengine/inputs/cf-report.cf cf3 > Parsing file /var/cfengine/inputs/cfengine_startup_scripts_manifests.cf cf3 Initiate variable convergence... cf3 -> Checking common class promises... cf3 # Knowledge map reporting feature is only available in version Nova and above cf3 -> Defined classes = { xxxxxxxxxxx 32_bit August Day16 ESV4 GMT_Hr15 Hr08 Hr08_Q1 Lcycle_0 Min00_05 Min03 Monday Morning Q1 STG Yr2010 any app_server cfengine_3 cfengine_3_0 cfengine_3_0_4 common community_edition compiled_on_solaris2_10 xxxxxxxxxxxx loghost net_iface_lo0 net_iface_nge2 net_iface_nge2_1 net_iface_nge3 solarisx86 stg sunos_5_10 sunos_i86pc sunos_i86pc_5_10 sunos_i86pc_5_10_Generic_142901_02 verbose_mode } cf3 -> Negated Classes = { } cf3 Initiate variable convergence... cf3 -> Checking common class promises... cf3 Initiate control variable convergence... cf3 -> Inputs are valid Here's the backtrace: $ gdb /var/cfengine/bin/cf-agent GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i386-pc-solaris2.10"... (gdb) run -v Starting program: /var/cfengine/bin/cf-agent -v warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.) warning: Lowest section in /usr/lib/libpthread.so.1 is .dynamic at 00000074 warning: Lowest section in /usr/lib/libthread.so.1 is .dynamic at 00000074 cf3 Cfengine - autonomous configuration engine - commence self-diagnostic prelude cf3 ------------------------------------------------------------------------ cf3 Work directory is /var/cfengine cf3 Making sure that locks are private... cf3 Checking integrity of the state database cf3 Checking integrity of the module directory cf3 Checking integrity of the PKI directory cf3 Looking for a source of entropy in /var/cfengine/randseed cf3 Loaded /var/cfengine/ppkeys/localhost.priv cf3 Loaded /var/cfengine/ppkeys/localhost.pub cf3 No registered cfengine service, using default cf3 !!! System error for getservbyname: "Error 0" cf3 Setting cfengine default port to 5308 = 5308 cf3 Reference time set to Mon Aug 16 08:02:54 2010 cf3 Cfengine - 3.0.4 (C) Cfengine AS 2008- cf3 ------------------------------------------------------------------------ cf3 Host name is: xxxxxxxxxx cf3 Operating System Type is sunos cf3 Operating System Release is 5.10 cf3 Architecture = i86pc cf3 Using internal soft-class solarisx86 for host xxxxxxxxxxxx cf3 The time is now Mon Aug 16 08:02:54 2010 cf3 ------------------------------------------------------------------------ cf3 # Extended system discovery is only available in version Nova and above cf3 Additional hard class defined as: 32_bit cf3 Additional hard class defined as: sunos_5_10 cf3 Additional hard class defined as: sunos_i86pc cf3 Additional hard class defined as: sunos_i86pc_5_10 cf3 Additional hard class defined as: i386 cf3 Additional hard class defined as: i86pc cf3 GNU autoconf class from compile time: compiled_on_solaris2_10 cf3 Address given by nameserver: xxxxxxxxxx cf3 Interface 1: lo0 cf3 Interface 2: nge2 cf3 Adding alias loghost.. cf3 Interface 4: nge3 cf3 Trying to locate my IPv6 address cf3 Looking for environment from cf-monitor... cf3 Unable to detect environment from cfMonitord cf3 *********************************************************** cf3 Loading persistent classes cf3 *********************************************************** cf3 *********************************************************** cf3 Loaded persistent memory cf3 *********************************************************** cf3 > Verifying the syntax of the inputs... cf3 > Parsing file /var/cfengine/inputs/promises.cf cf3 Initiate variable convergence... cf3 -> Checking common class promises... cf3 Executing and using module cf3 Activated classes: app_server cf3 Executing and using module cf3 Activated classes: ESV4 cf3 Activated classes: STG cf3 Initiate control variable convergence... cf3 > Parsing file /var/cfengine/inputs/cfengine_stdlib.cf cf3 > Parsing file /var/cfengine/inputs/cf-execd.cf cf3 > Parsing file /var/cfengine/inputs/cf-monitord.cf cf3 > Parsing file /var/cfengine/inputs/cf-report.cf cf3 > Parsing file /var/cfengine/inputs/cfengine_startup_scripts_manifests.cf cf3 Initiate variable convergence... cf3 -> Checking common class promises... Program received signal SIGSEGV, Segmentation fault. 0x080953ff in EvaluateORString (class=0x796e61 , list=0x0, fromIsInstallable=0) at env_context.c:866 866 env_context.c: No such file or directory. in env_context.c (gdb) back #0 0x080953ff in EvaluateORString (class=0x796e61 , list=0x0, fromIsInstallable=0) at env_context.c:866 #1 0x080955af in IsDefinedClass (class=0x796e61 ) at env_context.c:844 #2 0x08095780 in EvalClassExpression (cp=0x8361c90, pp=0x839a940) at env_context.c:648 #3 0x08095c4d in KeepClassContextPromise (pp=0x839a940) at env_context.c:60 #4 0x08092225 in CheckCommonClassPromises (classlist=0x836ffe0) at generic_agent.c:1379 #5 0x0809235b in HashVariables () at generic_agent.c:1647 #6 0x08092aab in Cf3ParseFiles () at generic_agent.c:557 #7 0x08092bc4 in ReadPromises (ag=cf_agent, agents=0x8272d6f "agent") at generic_agent.c:195 #8 0x08092e0a in GenericInitialize (argc=2, argv=0x804785c, agents=0x8272d6f "agent") at generic_agent.c:106 #9 0x08086d39 in main (argc=2, argv=0x804785c) at agent.c:138 And here are my configs: $ cat promises.cf body common control { bundlesequence => { "garbage_collection", "cfengine_startup_scripts_manifests", }; inputs => { # Separate config files for each CFEngine daemon and the standard library. "cfengine_stdlib.cf", "cf-execd.cf", "cf-monitord.cf", "cf-report.cf", # Phase 1 configurations "cfengine_startup_scripts_manifests.cf", }; } ####################################################### bundle common global { # Define some global variables vars: "masterfiles" string => "/var/cfengine/masterfiles"; "inputs" string => "/var/cfengine/inputs"; "workdir" string => "/var/cfengine"; classes: # Define classes for app,db,hadoop server for group manifests "no_class_defined" or => usemodule("module_machine_type",""); # Define the colocation facility we are in, and which environment (PROD, STG, DR, etc.) "no_site_env_defined" or => usemodule("module_site_env",""); } ####################################################### body agent control { # if default runtime is 5 mins we need this for long jobs ifelapsed => "15"; # Allow us to use DNS skipidentify => "false"; } ####################################################### $ cat cf-execd.cf body executor control { # In the lab, set splaytime = 1 for quick updates. In Prod, make sure this is at least 10 minutes splaytime => "1"; mailto => xxxxxxxxxxxxxxxxxx mailfrom => "r...@$(sys.host)"; smtpserver => "localhost"; schedule => { "Min00", "Min05", "Min10", "Min15", "Min20", "Min25", "Min30", "Min35", "Min40", "Min45", "Min50", "Min55" }; executorfacility => "LOG_DAEMON"; # This is the command that actually drives cf-execd to execute cf-agent on the schedule above. exec_command => "${sys.workdir}/bin/cf-agent -f failsafe.cf && ${sys.workdir}/bin/cf-agent"; } ########################################## bundle agent garbage_collection { files: "$(sys.workdir)/outputs" delete => tidy, file_select => days_old("3"), depth_search => recurse("inf"); } $ cat cf-monitord.cf body monitor control { forgetrate => "0.7"; histograms => "true"; monitorfacility => "LOG_DAEMON"; } $ cat cf-report.cf body reporter control { reports => { "all" }; build_directory => "$(sys.workdir)/reports"; report_output => "text"; time_stamps => "true"; } And finally, the policy causing the segfault. $ cat cfengine_startup_scripts_manifests.cf bundle agent cfengine_startup_scripts_manifests { files: # Linux or Solaris, doesn't matter. Copy the startup scripts into place. "/var/cfengine/etc" handle => "startup_scripts_for_all_cfengine_daemons", perms => mog("700","root","root"), copy_from => no_backup_cp("/var/cfengine/inputs/config-general/cfengine_startup_scripts_manifests"), depth_search => recurse("inf"), action => immediate; # For Solaris, verify that the SMF manifests are there. They aren't actually directly called # because they are imported into the SMF repository, but this is where they belong. sunos_5_10:: "/var/cfengine/etc" handle => "SMF_manifests_for_all_cfengine_daemons", perms => mog("700","root","root"), copy_from => no_backup_cp("/var/cfengine/inputs/config-solaris/cfengine_startup_scripts_manifests"), depth_search => recurse("inf"), action => immediate; } If I comment out the sunos_5_10:: promise, the segfault goes away -- so the problem is somewhere in there. This isn't a road block for me at the moment, but if I am writing my policies incorrectly or doing something wrong it would be helpful to know. Thanks! Mike _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine