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 (was Re: cfpclose() or "packages: under


From: rader
Subject: fix for a bug in cfservd v2.1.11 (was Re: cfpclose() or "packages: under cfrun only" bug on RHEL3?)
Date: Thu, 24 Feb 2005 13:05:04 -0600

Mark:

Dan--my systems programmer guru--and I just spent a few hours with
this.  It appears that cfservd version 2.1.11 introduces a change
where it ignores SIGCHLD, which in turn gets inherited by cfagent.
This, in turn, causes cfpclose() to fail it's waitpid() because
zombie processes get automatically removed by (at least some)
Linux kernels when SIGCHLD is set to SIG_IGN.

Refer to the proof of concept code after my sig.  I have verified
that the problem exists on RedHat7.3, RedHat9, RHEL3 and FC3.
Remove the signal() call, call it "cfagent", and can you can verify
the problem with cfservd.

Please consider removing the "signal(SIGCHLD,SIG_IGN)" line from
cfservd.c because it makes all code that calls cfpclose() fail when
ran under cfrun.

Or perhaps restore SIGCHLD to the default handler in the child
branch of the fork() in cfpopen() in popen.c?

The ChangeLog for 2.1.11 reads

     SIGPIPE and SIGCHLD added to signal handler (SIGCHILD ignored against 
posix, but
     how the hell do you sort this out?)

but it does not explain *why* cfservd now ignores SIGCHLD and
SIGPIPE?

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

#include "stdio.h"
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include "signal.h"

extern int errno;

main () {

  int pid;

  signal(SIGCHLD,SIG_IGN); /* HERE causes waitpid() failure on some Linux 
kernels */ 

  pid = fork();

  if ( pid == 0 ) {
    /* become a zombie */
    exit(0);
  } else {
    int rc, status;
    sleep(5);
    rc = waitpid(pid,&status,0);
    printf("waitpid said %d\n",rc);
    if ( rc == -1 ) {
      printf("waitpid failed: %s\n",strerror(errno));
    }
  }

}

 > ---- Original Message ----
 > From: rader
 > 
 > Has anyone noticed that packages actions work via cfagent but
 > always return "not installed" via cfrun??  I'm seeing this problem
 > with Dag's 2.1.11 on Scientific Linux 3.0.4 (recompiled RHEL3.)
 > Details follow my sig.
 > 
 > Looks like RPMPackageCheck() fires off "rpm -q ..." via cfpopen()
 > and then cfpclose() is failing--but only under cfrun.
 > 
 > ?
 > 
 > steve 
 > - - - 
 > systems & network manager
 > high energy physics
 > university of wisconsin
 > - - - 
 > 
 > I have...
 > 
 >   [...]
 >   DefaultPkgMgr = ( rpm )
 >   [...]
 >   packages:
 >     beebalm::
 >       compat-slang version=0:1.4.5-5 cmp=ge 
 >         define=has_compat_slang elsedefine=do_compat_slang
 >   shellcommands:
 >     do_compat_slang::
 >        "/bin/echo NEEDS compat-slang"
 >     has_compat_slang::
 >        "/bin/echo HAS compat-slang"
 > 
 > and on beebalm I do
 > 
 >  sudo cfagent -d0 --no-splay 
 > 
 > and I get
 > 
 >  cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" comp
 > at-slang)
 >  Appending [(none):1.4.5-5]
 >  cfpclose(pp)
 >  cfpopen - Waiting for process 16986
 >  RPMCheckPackage(): Requested compat-slang ge 0:1.4.5-5
 >  RPMCheckPackage(): Trying installed version 0:1.4.5-5
 >  Comparison result: eq
 > 
 > okay, cool, but when I do 
 > 
 >  sudo cfrun beebalm -- -d0 --nosplay
 > 
 > I get
 > 
 >  cfpopen(/bin/rpm -q --queryformat "%{EPOCH}:%{VERSION}-%{RELEASE}\n" comp
 > at-slang)
 >  Appending [(none):1.4.5-5]
 >  cfpclose(pp)
 >  cfpopen - Waiting for process 17039
 >  RPM Package compat-slang not installed.
 > 
 > 
 > 
 > _______________________________________________
 > Bug-cfengine mailing list
 > address@hidden
 > http://lists.gnu.org/mailman/listinfo/bug-cfengine





reply via email to

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