[rrd-developers] never ending loop in rrd_graph

Ole Bjørn Hessen obh at telenor.net
Tue Jan 10 01:49:19 MET 2006


I discovered a never endring loop in rrd_graph. I'm not sure what how
to handle this thing.

draw_horizontal_grid was called with im->ygrid_scale.gridstep = 0 and
this lead to massive confusion in draw_horizontal_grid. 

The loop "for (i = sgrid; i <= egrid; i++){" in draw_horizontal_grid
was going on forever.  

Using gcc/gdb on Solaris 8 to debug this I saw that sgrid printed out
as -2147483648 and egrid was 2147483647.

The value "im->ygrid_scale.gridstep = 0" was there because that "pixel
= im->ysize / (scaledrange / ylab[i].grid)" never reached 7 in
calc_horizontal_grid so 'gridind' remained -1. A lookup at using
"gridind=-1" at ylab was no good idea since ylab[-1] was not
well-defined :-)

        im->ygrid_scale.gridstep = ylab[gridind].grid * im->magfact;

I tried to add more values to ylab and that seems to "fix" this, but I
do not have the faintes clue if this is a good or bad fix.

ylab_t ylab[]= {
        ...
    {1000.0, {1,2, 5,10}},
    {2000.0, {1,5,10,20}},
    {5000.0, {1,2, 4,10}},
    {10000.0, {1,2, 5,10}},
    {20000.0, {1,5,10,20}},
    {50000.0, {1,2, 4,10}},
    {100000.0, {1,2, 5,10}},
    {200000.0, {1,5,10,20}},
    {500000.0, {1,2, 4,10}},
    {0.0,   {0,0,0,0}}};

Any comments?

Ole Bjørn Hessen,
NMS-IP, PF-Nett, Telenor Networks

--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-developers
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-developers mailing list