From: Dave H. <hel...@us...> - 2014-10-06 05:40:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gather - Metric Data Gatherer". The branch, master has been updated via adb18fc7b8eaa97c731d947d9773721e58dc8d9c (commit) from 76ae836d38ca605daade069fbb5f5ec0ab304651 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit adb18fc7b8eaa97c731d947d9773721e58dc8d9c Author: Dave Heller <hel...@us...> Date: Mon Oct 6 01:39:14 2014 -0400 Fixed #2739: reposd SIGFPE during calculation of interval metric ----------------------------------------------------------------------- Summary of changes: ChangeLog | 6 ++++++ NEWS | 1 + gather.c | 7 +++++++ gatherd.c | 11 +++++++++++ plugin/repositoryUnixProcess.c | 10 ++++++---- repos.c | 9 +++++++++ 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51d9a9d..9e3ff19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-10-06 Dave Heller <hel...@us...> + + * NEWS, gather.c, gatherd.c, plugin/repositoryUnixProcess.c, repos.c + + Fixed #2739: reposd SIGFPE during calculation of interval metric + 2014-02-10 Dave Heller <hel...@us...> * NEWS, mreposl.c diff --git a/NEWS b/NEWS index c46dfb3..2a47ea7 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ Bugs fixed: - #2664 no guest counter in /proc/stat on older kernels - #2722 compile fails when -Werror=format-security flag is used - #2723 repository reported error for GI on interval metric +- #2739 reposd SIGFPE during calculation of interval metric Changes in Version 2.2.8 ======================== diff --git a/gather.c b/gather.c index eaa79c7..ba4324f 100644 --- a/gather.c +++ b/gather.c @@ -375,5 +375,12 @@ static void gather_sample(int id) md=MPR_GetMetric(id); if (md && md->mproc) { md->mproc(id,MetricRepository->mrep_add); + /* For testing [bugs:#2739] */ + extern char *hiccup; + if (hiccup && !strcmp(md->mdName, hiccup)) { + fprintf(stderr,"--> %s(%i) : gather_sample() adding duplicate value for \"%s\"\n", + __FILE__,__LINE__,md->mdName); + md->mproc(id,MetricRepository->mrep_add); // hack to add dup value to the repo + } } } diff --git a/gatherd.c b/gatherd.c index 6a09f59..e891e5d 100644 --- a/gatherd.c +++ b/gatherd.c @@ -34,6 +34,8 @@ #define CHECKBUFFER(comm,buffer,sz,len) ((comm)->gc_datalen+sizeof(GATHERCOMM)+(sz)<=len) +char *hiccup; + int main(int argc, char * argv[]) { int quit=0; @@ -62,6 +64,15 @@ int main(int argc, char * argv[]) } } + /* For testing [bugs:#2739] */ + if (argc == 2 && !strncasecmp(argv[1],"hiccup=",7)) { + if (argv[1][7]) { + hiccup = strdup(argv[1] + 7); + fprintf(stderr,"--> %s(%i) : Hiccup on metric \"%s\"\n", + __FILE__,__LINE__,hiccup); + } + } + if (gathercfg_init()) { m_log(M_ERROR,M_SHOW,"Could not open gatherd config file.\n"); } diff --git a/plugin/repositoryUnixProcess.c b/plugin/repositoryUnixProcess.c index 785d624..b87416f 100644 --- a/plugin/repositoryUnixProcess.c +++ b/plugin/repositoryUnixProcess.c @@ -608,8 +608,9 @@ size_t metricCalcPageInRate( MetricValue *mv, __FILE__,__LINE__); #endif if ( mv && (vlen>=sizeof(unsigned long long)) && (mnum>=2) ) { - total = (*(unsigned long long*)mv[0].mvData - *(unsigned long long*)mv[mnum-1].mvData) / - (mv[0].mvTimeStamp - mv[mnum-1].mvTimeStamp); + total = (unsigned long long) (ntohll(*(unsigned long long*) mv[0].mvData) + - ntohll(*(unsigned long long*) mv[mnum - 1].mvData)) + / (mv[0].mvTimeStamp - mv[mnum - 1].mvTimeStamp); memcpy(v, &total, sizeof(unsigned long long)); return sizeof(unsigned long long); } @@ -655,8 +656,9 @@ size_t metricCalcPageOutRate( MetricValue *mv, __FILE__,__LINE__); #endif if ( mv && (vlen>=sizeof(unsigned long long)) && (mnum>=2) ) { - total = (*(unsigned long long*)mv[0].mvData - *(unsigned long long*)mv[mnum-1].mvData) / - (mv[0].mvTimeStamp - mv[mnum-1].mvTimeStamp); + total = (unsigned long long) (ntohll(*(unsigned long long*) mv[0].mvData) + - ntohll(*(unsigned long long*) mv[mnum - 1].mvData)) + / (mv[0].mvTimeStamp - mv[mnum - 1].mvTimeStamp); memcpy(v, &total, sizeof(unsigned long long)); return sizeof(unsigned long long); } diff --git a/repos.c b/repos.c index 22fd4c7..e394fc5 100644 --- a/repos.c +++ b/repos.c @@ -23,6 +23,7 @@ #include "repos.h" #include "rreg.h" #include "rplugmgr.h" +#include "mlog.h" #include "mrepos.h" #include "mtrace.h" #include <reposcfg.h> @@ -382,6 +383,14 @@ int reposvalue_get(ValueRequest *vs, COMMHEAP ch) ch_alloc(ch,vs->vsValues[actnum].viValueLen); vs->vsValues[actnum].viResource=ch_alloc(ch,reslen); memcpy(vs->vsValues[actnum].viResource, mv[j][numv[j]-1].mvResource,reslen); + /* Workround for [bugs:#2739]: check for duplicate timestamp, don't crash */ + if (mv[j][0].mvTimeStamp == mv[j][1].mvTimeStamp) { + m_log(M_ERROR,M_SHOW,"Hit repeated value on calculation of %s (mid=%d)\n", mc->mcName, mv[j][0].mvId); + m_log(M_ERROR,M_SHOW,"0: sys=%s res=%s value=%lu at %lu\n",mv[j][0].mvSystemId, mv[j][0].mvResource, ntohll(*(unsigned long long*)mv[j][0].mvData), mv[j][0].mvTimeStamp); + m_log(M_ERROR,M_SHOW,"1: sys=%s res=%s value=%lu at %lu\n",mv[j][1].mvSystemId, mv[j][1].mvResource, ntohll(*(unsigned long long*)mv[j][1].mvData), mv[j][1].mvTimeStamp); + memset(vs->vsValues[actnum].viValue, 0, sizeof(unsigned long long)); + vs->vsValues[actnum].viValueLen = sizeof(unsigned long long); + } else // do the calculation as normal if (mc->mcCalc(mv[j], numv[j], vs->vsValues[actnum].viValue, hooks/post-receive -- gather - Metric Data Gatherer |