From 959a5e7d04375933eeb3d6d01be47ae445cf7582 Mon Sep 17 00:00:00 2001 From: "Costa Tsaousis (ktsaou)" Date: Fri, 18 Dec 2015 21:08:24 +0200 Subject: [PATCH] fixed the bug where randomly chart dimensions were hidden - it was caused due to unitialized use of allocated space --- netdata-installer.sh | 2 +- src/main.c | 4 ++++ src/rrd2json.c | 10 ++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/netdata-installer.sh b/netdata-installer.sh index 82985472..91a09f3c 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -105,7 +105,7 @@ run ./configure \ --sysconfdir="${NETDATA_PREFIX}/etc" \ --localstatedir="${NETDATA_PREFIX}/var" \ --with-zlib --with-math --with-user=netdata \ - CFLAGS="-O2" || exit 1 + CFLAGS="-O3" || exit 1 # remove the build_error hook trap - EXIT diff --git a/src/main.c b/src/main.c index c35dd71e..11d69cdb 100755 --- a/src/main.c +++ b/src/main.c @@ -430,6 +430,10 @@ int main(int argc, char **argv) // catch all signals for (i = 1 ; i < 65 ;i++) { switch(i) { + case SIGKILL: // not catchable + case SIGSTOP: // not catchable + break; + case SIGSEGV: case SIGFPE: case SIGCHLD: diff --git a/src/rrd2json.c b/src/rrd2json.c index 675d158a..028824dd 100755 --- a/src/rrd2json.c +++ b/src/rrd2json.c @@ -1082,6 +1082,13 @@ static RRDR *rrdr_create(RRDSET *st, int n) r->od = malloc(r->d * sizeof(uint8_t)); if(unlikely(!r->od)) goto cleanup; + // set the hidden flag on hidden dimensions + int c; + for(c = 0, rd = st->dimensions ; rd ; c++, rd = rd->next) { + if(unlikely(rd->flags & RRDDIM_FLAG_HIDDEN)) r->od[c] = RRDR_HIDDEN; + else r->od[c] = 0; + } + r->c = -1; r->group = 1; @@ -1346,11 +1353,10 @@ RRDR *rrd2rrdr(RRDSET *st, long points, long long after, long long before, int g calculated_number *cn = rrdr_line_values(r); uint8_t *co = rrdr_line_options(r); - for(rd = st->dimensions, c = 0 ; likely(rd && c < dimensions) ; rd = rd->next, c++) { + for(rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++) { // update the dimension options if(likely(found_non_zero[c])) r->od[c] |= RRDR_NONZERO; - if(unlikely(rd->flags & RRDDIM_FLAG_HIDDEN)) r->od[c] |= RRDR_HIDDEN; // store the specific point options co[c] = group_options[c]; -- 2.39.2