bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix for a bug in cfservd v2.1.11 [and up]


From: rader
Subject: fix for a bug in cfservd v2.1.11 [and up]
Date: Thu, 24 Feb 2005 17:14:26 -0600

 > From: Mark Burgess
 > I don't understand why you ae patching 2.1.11 when we are up to 2.1.13 
 > and then some. 

Here's why: Cfengine is a complex beast.  It's very hard to know if
a "problem" is an actual bug or simply a misunderstanding of how
cfengine behaves.  When things aren't working, my instinct is to
build the version I'm currently running and debug it.  

That said, your point is well taken.  Sorry.  In the future I'll
only report about problems in the context of the latest version.
(Fwiw, I did convince myself the problem still exists by inspecting
the 2.1.13 ChangeLog, popen.c and cfservd.c before posting.)

 > Hvae you verified that this perists in 2.1.13?

Yes: what I'm observing is that cfrun under the latest snapshot
is badly broken.  Details showing the bug and a potential fix for
the latest snapshot follow.

If you'd like any other information or whatever, please let me
know.  I'll be happy to create a tarball with a terse config that
demonstrates the problem.  Thanks.

steve 
- - - 
systems & network manager
high energy physics
university of wisconsin

------------------------------------------------------------------
Step 1) downloaded cfengine-snap.tar.gz and built version 2.1.15a1

------------------------------------------------------------------
Step 2) added the following to debug the problem in verbose mode:

beebalm(rader): diff -u popen.c.orig popen.c
--- popen.c.orig        2005-02-22 15:10:40.000000000 -0600
+++ popen.c     2005-02-24 16:33:51.000000000 -0600
@@ -51,6 +51,7 @@
    FILE *pp = NULL;
 
  Debug("cfpopen(%s)\n",command);
+Verbose("SRDEBUG: cfpopen(%s)\n",command);
 
  if ((*type != 'r' && *type != 'w') || (type[1] != '\0'))
     {
@@ -632,6 +633,7 @@
    {
    if (errno != EINTR)
       {
+Verbose("SRDEBUG: cfpclose() failed: %s\n",strerror(errno)); 
       return -1;
       }
    }

------------------------------------------------------------------
Step 3) installed the resulting executables

------------------------------------------------------------------
Step 4) verified that cfagent is working fine:

beebalm(rader): cfagent -V | head -1
GNU cfengine 2.1.15a1
beebalm(rader):  sudo cfagent -qv | grep SRDEBUG
SRDEBUG: cfpopen(/sbin/ifconfig -a)
SRDEBUG: cfpopen(/var/cfengine/modules/module:DateStamp )
SRDEBUG: cfpopen(/var/cfengine/modules/module:HasAFS )
SRDEBUG: cfpopen(/var/cfengine/modules/module:HasSL )
SRDEBUG: cfpopen(/bin/ps auxw)
SRDEBUG: cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" 
compat-pwdb)
SRDEBUG: cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" 
compat-slang)
SRDEBUG: cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" 
python-crypto)

------------------------------------------------------------------
Step 5) verified that cfagent 2.1.15a via cfrun is broken:

ginseng(rader): sudo cfrun beebalm -- -qv | grep SRDEBUG
SRDEBUG: cfpopen(/sbin/ifconfig -a)
SRDEBUG: cfpclose() failed: No child processes
SRDEBUG: cfpopen(/var/cfengine/modules/module:DateStamp )
SRDEBUG: cfpclose() failed: No child processes
SRDEBUG: cfpopen(/var/cfengine/modules/module:HasAFS )
SRDEBUG: cfpclose() failed: No child processes
SRDEBUG: cfpopen(/var/cfengine/modules/module:HasSL )
SRDEBUG: cfpclose() failed: No child processes
SRDEBUG: cfpopen(/bin/ps auxw)
SRDEBUG: cfpclose() failed: No child processes
SRDEBUG: cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" 
compat-pwdb)
SRDEBUG: cfpclose() failed: No child processes
SRDEBUG: cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" 
compat-slang)
SRDEBUG: cfpclose() failed: No child processes
SRDEBUG: cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" 
python-crypto)
SRDEBUG: cfpclose() failed: No child processes

------------------------------------------------------------------
Step 6) assuming signal(SIGCHLD,SIG_IGN) in cfservd.c has some 
purpose, I added the default signal handler for SIGCHLD in 
cfpopen()...

beebalm(rader): diff -u popen.c.orig popen.c
--- popen.c.orig        2005-02-22 15:10:40.000000000 -0600
+++ popen.c     2005-02-24 16:46:46.000000000 -0600
@@ -51,6 +51,7 @@
    FILE *pp = NULL;
 
  Debug("cfpopen(%s)\n",command);
+Verbose("SRDEBUG: cfpopen(%s)\n",command);
 
  if ((*type != 'r' && *type != 'w') || (type[1] != '\0'))
     {
@@ -75,6 +76,9 @@
     {
     return NULL;
     }
+
+/* HERE SR restoring default sig handler for SIGCHLD HERE */
+signal(SIGCHLD,SIG_DFL);
  
  if (pid == 0)
     {
@@ -632,6 +636,7 @@
    {
    if (errno != EINTR)
       {
+Verbose("SRDEBUG: cfpclose() failed: %s\n",strerror(errno)); 
       return -1;
       }
    }

------------------------------------------------------------------
Step 7) installed the resulting executables

------------------------------------------------------------------
Step 8) verifed that the cfpclose() bug is gone... or, it's almost
gone... notice that ifconfig -a still fails... but at least it's
not creating zombies!

ginseng(rader): sudo cfrun beebalm -- -qv | grep SRDEBUG
SRDEBUG: cfpopen(/sbin/ifconfig -a)
SRDEBUG: cfpclose() failed: No child processes
SRDEBUG: cfpopen(/var/cfengine/modules/module:DateStamp )
SRDEBUG: cfpopen(/var/cfengine/modules/module:HasAFS )
SRDEBUG: cfpopen(/var/cfengine/modules/module:HasSL )
SRDEBUG: cfpopen(/bin/ps auxw)
SRDEBUG: cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" 
compat-pwdb)
SRDEBUG: cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" 
compat-slang)
SRDEBUG: cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" 
python-crypto)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]