Date: Mon, 6 Aug 2001 12:29:02 -0500 (CDT) From: Michael Kyle <mike@rainc.com> To: <gordont@bluemtn.net> Cc: <ports@freebsd.org> Subject: cfengine-1.6.3 deadlock issue (w/patch) Message-ID: <Pine.BSF.4.33.0108061221220.97749-100000@elvis.mu.org>
next in thread | raw e-mail | index | archive | help
Hi Gordon, There is a potential deadlock problem in cfengine on freebsd that can cause cfengine to use 100% cpu in a very busy wait state. Description All binaries in the cfengine distribution are built against pthreads. However, only cfd uses a mutex when using the resolver. Since the resolver routines in libc_r are not thread safe, we eventually have a problem. Fix Only build cfd against pthtreads. Link all other binaries against libc. Patch - against cfengine 1.6.3 distribution from Mark Burgess. - fixes the problem discussed above - much cleaner fix for the 'ioctl: No such network device' error message. I have included in my diff a one line patch to 'misc.c' that fixes this problem. Index: configure =================================================================== RCS file: /CVSROOT/vendor/cfengine/configure,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- configure 2001/08/01 21:50:41 1.1.1.1 +++ configure 2001/08/05 18:51:27 1.3 @@ -4708,7 +4708,8 @@ #define FREEBSD 1 EOF - CFLAGS="$CFLAGS -pthread" + CFLAGS="$CFLAGS" for ac_hdr in pthread.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` Index: configure.in =================================================================== RCS file: /vendor/cfengine/configure.in,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 configure.in --- configure.in 2001/08/01 21:50:41 1.1.1.1 +++ configure.in 2001/08/06 17:05:46 @@ -260,7 +260,7 @@ ;; freebsd*) AC_DEFINE(FREEBSD) - CFLAGS="$CFLAGS -pthread" + CFLAGS="$CFLAGS" AC_CHECK_HEADERS(pthread.h) ;; netbsd*) Index: src/Makefile.in =================================================================== RCS file: /vendor/cfengine/src/Makefile.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- src/Makefile.in 2001/08/01 21:50:42 1.1.1.1 +++ src/Makefile.in 2001/08/02 04:40:08 1.2 @@ -273,7 +273,7 @@ cfd: $(cfd_OBJECTS) $(cfd_DEPENDENCIES) @rm -f cfd - $(LINK) $(cfd_LDFLAGS) $(cfd_OBJECTS) $(cfd_LDADD) $(LIBS) + $(LINK) -pthread $(cfd_LDFLAGS) $(cfd_OBJECTS) $(cfd_LDADD) $(LIBS) cfrun: $(cfrun_OBJECTS) $(cfrun_DEPENDENCIES) @rm -f cfrun @@ -340,6 +340,7 @@ acl.o: acl.c cf.defs.h conf.h prototypes.h cf.extern.h cfd.o: cfd.c cf.defs.h conf.h prototypes.h cf.extern.h ../pub/getopt.h \ cfd.h + $(COMPILE) -pthread -c $< cfengine.o: cfengine.c cf.defs.h conf.h prototypes.h cf.extern.h \ ../pub/getopt.h cfkey.o: cfkey.c cf.defs.h conf.h prototypes.h cf.extern.h Index: src/misc.c =================================================================== RCS file: /vendor/cfengine/src/misc.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 misc.c --- src/misc.c 2001/08/01 21:50:42 1.1.1.1 +++ src/misc.c 2001/08/06 17:05:46 @@ -284,7 +284,7 @@ list.ifc_len = sizeof(ifbuf); list.ifc_req = ifbuf; -if (ioctl(fd, SIOCGIFCONF, &list) == -1 || (list.ifc_len < (sizeof(struct ifreq)))) +if (ioctl(fd, OSIOCGIFCONF, &list) == -1 || (list.ifc_len < (sizeof(struct ifreq)))) { CfLog(cferror,"Couldn't get interfaces","ioctl"); exit(1); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.33.0108061221220.97749-100000>