Bug 116144 - sysutils/ganglia-monitor-core crashes frequently
Summary: sysutils/ganglia-monitor-core crashes frequently
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-06 08:40 UTC by KOIE Hidetaka
Modified: 2009-01-30 23:10 UTC (History)
0 users

See Also:


Attachments
file.diff (3.33 KB, patch)
2007-09-06 08:40 UTC, KOIE Hidetaka
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description KOIE Hidetaka 2007-09-06 08:40:02 UTC
I have 2 problems:
(1) gmond in ganglia crashes by ABRT/SEGV.
    It seems memory corruption.
(2)gmond reports wrong disk statistics.

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-09-06 12:37:04 UTC
State Changed
From-To: open->feedback

Which port is this about?
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2007-09-06 22:49:30 UTC
Responsible Changed
From-To: freebsd-ports-bugs->brooks

Over to maintainer
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2007-09-06 23:27:05 UTC
State Changed
From-To: feedback->open

Feedback received
Comment 4 Brooks Davis freebsd_committer freebsd_triage 2007-12-28 21:46:23 UTC
I'm sorry I haven't committed this yet.  I've had a hard time finding
enough to to figure out what the patch is doing.  If you could resubmit
a patch without the #if parts that would help me review it.

Thanks,
Brooks
Comment 5 KOIE Hidetaka 2008-01-04 05:47:56 UTC
The following is the patch without #if'ing.

*** libmetrics/freebsd/metrics.c.orig	2008-01-04 14:20:14.328891831 +0900
--- libmetrics/freebsd/metrics.c	2008-01-04 14:26:16.108767439 +0900
*************** static int mibswap[MIB_SWAPINFO_SIZE];
*** 99,105 ****
  static size_t mibswap_size;
  static kvm_t *kd = NULL;
  static int pagesize;
! static int	  skipvfs;
  
  /* Function prototypes */
  static long percentages(int cnt, int *out, register long *new,
--- 99,105 ----
  static size_t mibswap_size;
  static kvm_t *kd = NULL;
  static int pagesize;
! static int	  skipvfs = 1;
  
  /* Function prototypes */
  static long percentages(int cnt, int *out, register long *new,
*************** find_disk_space(double *total, double *t
*** 865,871 ****
  
  	netvfslist = makenetvfslist();
  	vfslist = makevfslist(netvfslist);
- 	free(netvfslist);
  
  	mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
  	mntsize = regetmntinfo(&mntbuf, mntsize, vfslist);
--- 865,870 ----
*************** find_disk_space(double *total, double *t
*** 883,888 ****
--- 882,889 ----
  			*tot_avail += mntbuf[i].f_bavail / toru;
  		}
  	}
+ 	free(vfslist);
+ 	free(netvfslist);
  
  	return most_full;
  }
*************** makevfslist(fslist)
*** 939,945 ****
  		return (NULL);
  	if (fslist[0] == 'n' && fslist[1] == 'o') {
  		fslist += 2;
! 		skipvfs = 1;
  	}
  	for (i = 0, nextcp = fslist; *nextcp; nextcp++)
  		if (*nextcp == ',')
--- 940,946 ----
  		return (NULL);
  	if (fslist[0] == 'n' && fslist[1] == 'o') {
  		fslist += 2;
! 		skipvfs = 0;
  	}
  	for (i = 0, nextcp = fslist; *nextcp; nextcp++)
  		if (*nextcp == ',')
*************** makenetvfslist(void)
*** 991,997 ****
  		goto done;
  	}
  
! 	for (cnt = 0; cnt < maxvfsconf; xvfsp++) {
  		if (xvfsp->vfc_flags & VFCF_NONLOCAL)
  			continue;
  
--- 992,1001 ----
  		goto done;
  	}
  
! 	cnt = 0;
! 	for (i = 0; i < maxvfsconf; i++, xvfsp++) {
! 		if (xvfsp->vfc_typenum == 0)
! 			continue;
  		if (xvfsp->vfc_flags & VFCF_NONLOCAL)
  			continue;
  
*************** makenetvfslist(void)
*** 1041,1050 ****
  	 * Count up the string lengths, we need a extra byte to hold
  	 * the between entries ',' or the NUL at the end.
  	 */
  	for (i = 0; i < cnt; i++)
! 		slen = strlen(listptr[i]) + 1;
! 	/* Add 2 for initial "no". */
! 	slen += 2;
  
  	if ((str = malloc(slen)) == NULL) {
  		warnx("malloc failed");
--- 1045,1057 ----
  	 * Count up the string lengths, we need a extra byte to hold
  	 * the between entries ',' or the NUL at the end.
  	 */
+ 	slen = 0;
  	for (i = 0; i < cnt; i++)
! 		slen += strlen(listptr[i]);
! 	/* for ',' */
! 	slen += cnt - 1;
! 	/* Add 3 for initial "no" and the NUL. */
! 	slen += 3;
  
  	if ((str = malloc(slen)) == NULL) {
  		warnx("malloc failed");
*************** makenetvfslist(void)
*** 1053,1062 ****
  
  	str[0] = 'n';
  	str[1] = 'o';
! 	for (i = 0, strptr = str + 2; i < cnt; i++, strptr++) {
  		strcpy(strptr, listptr[i]);
  		strptr += strlen(listptr[i]);
- 		*strptr = ',';
  	}
  	*strptr = '\0';
  
--- 1060,1070 ----
  
  	str[0] = 'n';
  	str[1] = 'o';
! 	for (i = 0, strptr = str + 2; i < cnt; i++) {
! 		if (i > 0)
! 		    *strptr++ = ',';
  		strcpy(strptr, listptr[i]);
  		strptr += strlen(listptr[i]);
  	}
  	*strptr = '\0';
Comment 6 dfilter service freebsd_committer freebsd_triage 2009-01-30 23:01:52 UTC
brooks      2009-01-30 23:01:39 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/ganglia-monitor-core Makefile 
  Added files:
    sysutils/ganglia-monitor-core/files 
                                        patch-libmetrics_freebsd_metrics.c 
  Log:
  At long last commit a patch to fix problems with disk statistic reporting
  and related crashes.
  
  Clean up a couple portlint nits at the same time.
  
  Submitted by:   KOIE Hidetaka <koie at suri dot co dot jp>
  PR:             ports/116144
  
  Revision  Changes    Path
  1.27      +3 -2      ports/sysutils/ganglia-monitor-core/Makefile
  1.3       +83 -0     ports/sysutils/ganglia-monitor-core/files/patch-libmetrics_freebsd_metrics.c (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 Brooks Davis freebsd_committer freebsd_triage 2009-01-30 23:04:48 UTC
State Changed
From-To: open->closed

Committed, thanks!  Sorry for taking so long to get this in.