[rrd-users] Bug in rrdtool?

Benny Baumann BenBE at geshi.org
Fri Jan 1 00:00:37 CET 2010


Hi,

Am 26.12.2009 08:37, schrieb Jean-Yves Avenard:
> Hi
>
> Merry Christmas to all of you reading ...
>
> Stretching the limit of rrdtool today ; I encountered an error I
> hadn't seen before:
> "ERROR: malloc im->gdes[gdi].data"
>   
Which version of RRDTool on what platform using which OS were you using?
ow was the interfacing with RRDTool (I'd guess Command Line client from
the source below)?
Is the error reproduceable? If so, to what extend? Could you provide the
offending RRD Database or does it happen with every file of a given format?
Could you check with a debugger to get some more specific information
about the issue?
> I was trying to plot monthly data; from the 1st to the end of each
> month ; like from 1/1/2009 to 31/1/2009, then 1/2/2009 to 28/2/2009
> etc...
>   
hmmm, usuaklly notihing to worry about ...
> All good until I tried to calculate the average.
> Here is a portion of the relevant code (in  PHP)
>   
Hmmm, maybe you might want to try the direct PHP bindings for PHP for
faster interfacing with RRDTool without needing process execution for
PHP to be enabled (improving security).
> At the time rrdtool is started ; the variable $month is a 2 dimensions array.
> $month[0] is for the current month ; with [0] being the start
> timestamp, and [1] being the end timestamp.
> then you get the previous 11 month
>
> So being in Decembe, for example $month[3][1]  is the end timestamp
> for the month of September.
>
> $cmd = "$RRDTOOL graph $name -l 0 \
> -t '$title' \
> -x $legend  --slope-mode \
> --step $res --start $start --end $timestamp \
> -w $width -h $height ";
>
> for ($i=0; $i<12; $i++) {
>    $cmd .= "DEF:ext{$i}=$EXTRRD2:total:AVERAGE:start={$month[$i][0]}:end={$month[$i][1]}
> \
>     VDEF:vext{$i}tot=ext{$i},TOTAL \
>     CDEF:cext{$i}=ext{$i},POP,vext{$i}tot ";
> }
>
> $cmd .=  "COMMENT:'        ' \
>  COMMENT:'Maximum  ' \
>     COMMENT:'Average  ' \
>     COMMENT:'Minimum      '  \
>     COMMENT:'Total\l' ";
>
> for ($i=0; $i<12; $i++) {
>    $cmd .= "AREA:cext{$i}#$COLOUR[ext]" . ($i == 0 ? ":'$LABEL[ext]' " : " ");
> }
>
> $cmd .= "DEF:ext=$EXTRRD2:total:AVERAGE VDEF:vexttot=ext,TOTAL ";
>
> $cmd .= "CDEF:cext=cext0,cext1,+,cext2,+,cext3,+,cext4,+,cext5,+,cext6,+,cext7,+,cext8,+,cext9,+,cext10,+,cext11,+
> ";
>
> $ret = exec($cmd . " > /dev/null", $output2, $status2);
>   
Could you provide the full command line that is being executed when the
problem appears?
> To calculate the monthly maximum , minimum and average ; I thought of
> simply adding each CDEF together. Forgetting the validity of that
> thought (it isn't valid as it would always result in UNKNOWN at all
> points)
>   
Could you elaborate on this?
> Googling for this error had related topics ; usually pointing to a
> lack of memory. This machine is a 64 bits linux (Ubuntu 9.10) and 4GB
> of RAM.
>   
Anyway adding 255 numbers ain't touch the limits of RRDTool ... Thus the
command line really would be interesting.
> It's that line $cmd .=
> "CDEF:cext=cext0,cext1,+,cext2,+,cext3,+,cext4,+,cext5,+,cext6,+,cext7,+,cext8,+,cext9,+,cext10,+,cext11,+
> ";
> that generates a malloc error.
> the RRD file is 14MB is size (for 5 years, 5 minutes average of data).
> So having a RAM issue seems unlikely...
>   
I'd second this
> Trying to localise the error ;
> having a CDEF with:
> "CDEF:cext=cext0,cext1,+" will work
> having a CDEF with:
> "CDEF:cext=cext0,cext1,+,cext2,+" will *not*
>   
Please try

"CDEF:cext=cext0,cext1,cext2,+,+"

> (the exact thing I had tried was having:
> $cmd .= "CDEF:cext=cext0,UN,0,cext0,IF,cext1,UN,0,cext1,IF,+,cext2,UN,0,cext2,IF,+
> ";
>   
Move complexity out of one CDEF and split it into multiple ones.
> But it can be reproduced with much simpler CDEF like mentioned above
> )
>
>   
Plese provide a small testcase script+rrd file that gives this error.
Instead of the rrdfile you could also provide a create statement for
such a file.
> Cheers
> Jean-Yves
>   
Regards,
BenBE.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20100101/c9699842/attachment-0001.pgp 


More information about the rrd-users mailing list