[rrd-users] Oddities with rrdtool

Jean-Yves Avenard jyavenard at gmail.com
Fri Jan 1 08:34:54 CET 2010


Hi

2010/1/1 Benny Baumann <BenBE at geshi.org>:
> If you are familiar with GDB debugging or one of its frontends (like
> DDD) some more details could be useful. Set a breakpoint at that line
> (in rrdgraph.c) and check the local context given.

I'm familiar with gdb ; but here I have no idea what to look for ..

I've copied the two rrd files use there:
http://www.avenard.org/files/rrdfile.tar.bz2

(they compress really well !)

The command line I used was:
rrdtool graph /tmp/powerjSwa9v -l 0 \
-t 'USAGE - DAILY (hourly average) 1/1/2010' \
-x HOUR:1:HOUR:4:HOUR:2:0:%k  --slope-mode \
--step 3600 --start 1262304000 --end 1262390400 \
-w 480 -h 120 \
COMMENT:'            ' \
    COMMENT:'Maximum    ' \
    COMMENT:'Average    ' \
    COMMENT:'Minimum    '  \
    COMMENT:'Total View\l'
DEF:total=currentcost3.rrd:total:AVERAGE:start=1262304000:end=1262343599
\
     CDEF:totalw=total,3600,/ CDEF:ctotal=totalw,3600,* \
    VDEF:vtotalmax=ctotal,MAXIMUM \
    VDEF:vtotalavg=ctotal,AVERAGE \
    VDEF:vtotalmin=ctotal,MINIMUM \
    VDEF:vtotaltot=totalw,TOTAL AREA:ctotal#ff4500:'Total   ' \
    GPRINT:vtotalmax:'%6.1lf %sWh ' \
    GPRINT:vtotalavg:'%6.1lf %sWh ' \
    GPRINT:vtotalmin:'%6.1lf %sWh  ' \
    GPRINT:vtotaltot:'%7.2lf %sWh\l'
DEF:ch1=currentcost3.rrd:ch1:AVERAGE:start=1262304000:end=1262343599 \
     CDEF:ch1w=ch1,3600,/ CDEF:cch1=ch1w,3600,* \
    VDEF:vch1max=cch1,MAXIMUM \
    VDEF:vch1avg=cch1,AVERAGE \
    VDEF:vch1min=cch1,MINIMUM \
    VDEF:vch1tot=ch1w,TOTAL AREA:cch1#add8e6:'Pool    ' \
    GPRINT:vch1max:'%6.1lf %sWh ' \
    GPRINT:vch1avg:'%6.1lf %sWh ' \
    GPRINT:vch1min:'%6.1lf %sWh  ' \
    GPRINT:vch1tot:'%7.2lf %sWh\l'
DEF:ext=solarprod3.rrd:total:AVERAGE:start=1262304000:end=1262343599 \
     CDEF:extw=ext CDEF:cext=extw,3600,* \
    VDEF:vextmax=cext,MAXIMUM \
    VDEF:vextavg=cext,AVERAGE \
    VDEF:vextmin=cext,MINIMUM \
    VDEF:vexttot=extw,TOTAL AREA:cext#FFd700a0:'Solar   ' \
    GPRINT:vextmax:'%6.1lf %sWh ' \
    GPRINT:vextavg:'%6.1lf %sWh ' \
    GPRINT:vextmin:'%6.1lf %sWh  ' \
    GPRINT:vexttot:'%7.2lf %sWh\l'
COMMENT:'-----------------------------------------------------------------\l'
HRULE:0#999999 DEF:import=feedin30min3.rrd:in:AVERAGE:start=1262304000:end=1262343599
\
    CDEF:importw=import,1800,/ \
    CDEF:cimport=importw,3600,* \
    CDEF:cimport2=cimport,-1,* \
    VDEF:vimportmax=cimport,MAXIMUM \
    VDEF:vimportavg=cimport,AVERAGE \
    VDEF:vimportmin=cimport,MINIMUM \
    VDEF:vimporttot=importw,TOTAL AREA:cimport2#ff4500:'Import  ' \
    GPRINT:vimportmax:'%6.1lf %sWh ' \
    GPRINT:vimportavg:'%6.1lf %sWh ' \
    GPRINT:vimportmin:'%6.1lf %sWh  ' \
    GPRINT:vimporttot:'%7.2lf %sWh\l'
DEF:export=feedin30min3.rrd:out:AVERAGE:start=1262304000:end=1262343599
\
    CDEF:exportw=export,1800,/ \
    CDEF:cexport=exportw,3600,* \
    CDEF:cexport2=cexport,-1,* \
    VDEF:vexportmax=cexport,MAXIMUM \
    VDEF:vexportavg=cexport,AVERAGE \
    VDEF:vexportmin=cexport,MINIMUM \
    VDEF:vexporttot=exportw,TOTAL AREA:cexport2#FFd700a0:'Export  ' \
    GPRINT:vexportmax:'%6.1lf %sWh ' \
    GPRINT:vexportavg:'%6.1lf %sWh ' \
    GPRINT:vexportmin:'%6.1lf %sWh  ' \
    GPRINT:vexporttot:'%7.2lf %sWh\l'

Even with a much simpler graph :
/usr/bin/rrdtool graph /tmp/power8eEy92 -l 0 \
-t 'USAGE - DAILY (hourly average) 1/1/2010' \
-x HOUR:1:HOUR:4:HOUR:2:0:%k  --slope-mode \
--step 3600 --start 1262304000 --end 1262390400 \
-w 960 -h 240 \
    COMMENT:'Maximum    ' \
    COMMENT:'Average    ' \
    COMMENT:'Minimum    '  \
    COMMENT:'Total View\l'
DEF:ch1=currentcost3.rrd:ch1:AVERAGE:start=1262304000:end=1262368799 \
     CDEF:ch1w=ch1,3600,/ CDEF:cch1=ch1w,3600,* \
    VDEF:vch1max=cch1,MAXIMUM \
    VDEF:vch1avg=cch1,AVERAGE \
    VDEF:vch1min=cch1,MINIMUM \
    VDEF:vch1tot=ch1w,TOTAL AREA:cch1#add8e6:'Pool    ' \
    GPRINT:vch1max:'%6.1lf %sWh ' \
    GPRINT:vch1avg:'%6.1lf %sWh ' \
    GPRINT:vch1min:'%6.1lf %sWh  ' \
    GPRINT:vch1tot:'%7.2lf %sWh\l'

==15097== Invalid read of size 8
==15097==    at 0x4E37D56: data_proc (rrd_graph.c:1253)
==15097==    by 0x4E3FFD1: graph_paint (rrd_graph.c:3276)
==15097==    by 0x4E43308: rrd_graph_v (rrd_graph.c:3939)
==15097==    by 0x4E42D05: rrd_graph (rrd_graph.c:3820)
==15097==    by 0x402F78: HandleInputLine (rrd_tool.c:790)
==15097==    by 0x40377B: main (rrd_tool.c:511)
==15097==  Address 0x9649e30 is 0 bytes after a block of size 144 alloc'd
==15097==    at 0x4C25153: malloc (vg_replace_malloc.c:195)
==15097==    by 0x4E37686: data_calc (rrd_graph.c:1127)
==15097==    by 0x4E3FC97: graph_paint (rrd_graph.c:3232)
==15097==    by 0x4E43308: rrd_graph_v (rrd_graph.c:3939)
==15097==    by 0x4E42D05: rrd_graph (rrd_graph.c:3820)
==15097==    by 0x402F78: HandleInputLine (rrd_tool.c:790)
==15097==    by 0x40377B: main (rrd_tool.c:511)


I get the same memory errors in valgrind ... So I think it will be
easily reproduceable by anyone ...



More information about the rrd-users mailing list