Package: rrdtool
Version: 1.3.1-4
Severity: important

Using "rrdtool restore" corrupts RRD files. According to its manual
page, rrdresize(1), the command is supposed to create a new file,
resize.rrd, and is not supposed to alter the original file in any way.
Unfortunately, the original file is altered and the newly created file
is unusable.

The following commands demonstrate the problems:

 1  o...@huhu:/tmp $ rrdtool create -s 10 test.rrd DS:value:GAUGE:20:0:U 
RRA:AVERAGE:0.5:1:360
 2  o...@huhu:/tmp $ ls -l test.rrd
    -rw-r--r-- 1 octo octo 3424 2010-10-20 14:42 test.rrd
 3  o...@huhu:/tmp $ sha1sum test.rrd
    915acef170e20588de560dfff907765aa99f7315  test.rrd
 4  o...@huhu:/tmp $ rrdtool resize test.rrd 0 GROW 8280
 5  o...@huhu:/tmp $ ls -l test.rrd resize.rrd
    -rw------- 1 octo octo 69664 2010-10-20 14:42 resize.rrd
    -rw-r--r-- 1 octo octo  3424 2010-10-20 14:42 test.rrd
 6  o...@huhu:/tmp $ sha1sum test.rrd
    5cbbfef92e0914141e763e0d1e47a5e11b83b620  test.rrd
 7  o...@huhu:/tmp $ rrdtool info test.rrd | grep rows
    rra[0].rows = 8640
 8  o...@huhu:/tmp $ rrdtool info resize.rrd | grep rows
    rra[0].rows = 8640
 9  o...@huhu:/tmp $ rrdtool dump resize.rrd | grep '<v>' | grep -v NaN | wc -l
    8280
10  o...@huhu:/tmp $ rrdtool dump test.rrd | grep '<v>' | grep -v NaN | wc -l
    0

Command 1 creates a new RRD file which is not used outside of this
demonstration. Command 4 alters the first and only RRA to hold one day
of data rather than one hour. In contrast to the documented behavior the
original file is changed, as you can see by the changed SHA1 sum.

Command 7 shows that the original file is now reported as having 8640
rows, although the file size didn't change (commands 2 and 5). This
leads to problems when you try to fill the file with data:

  o...@huhu:/tmp $ t=`date +%s`; for ((i=0; i < 100000; i++)); do rrdtool 
update test.rrd $t:42; let t="$t+10"; done
  [… a second or two pass, then …]
  Segmentation fault
  Segmentation fault
  Segmentation fault
  Segmentation fault
  Segmentation fault
  Segmentation fault
  Segmentation fault
  Segmentation fault
  Segmentation fault
  Segmentation fault
  rrdtool: symbol lookup error: /usr/lib/librrd.so.4: undefined symbol: rrd_free
  Segmentation fault
  Segmentation fault
  Segmentation fault
  rrdtool: symbol lookup error: /usr/lib/librrd.so.4: undefined symbol: free, 
version GLIBC_2.0
  Segmentation fault
  […]

The segmentation faults don't appear right away, but after a short
moment. I'm assuming that filling the first 360 rows works as expected.

resize.rrd has a different problem: The newly created rows *should* be
filled with NaN, since there is no reasonable default value to fill them
with. Instead, those 8280 rows are filled with something else (0.0 to be
precise), see command 9.

I didn't have a chance to dive into the code to track down the problem
yet. It appears, however, that SVN revision 1726 introduces a fix that
might address this problem.

Regards,
—octo

[0] <http://oss.oetiker.ch/rrdtool-trac/changeset/1726/>

-- System Information:
Debian Release: 5.0.6
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=UTF-8) (ignored: LC_ALL set to 
en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages rrdtool depends on:
ii  libc6                  2.7-18lenny4      GNU C Library: Shared libraries
ii  libfontconfig1         2.6.0-3           generic font configuration library
ii  libpixman-1-0          0.10.0-2          pixel-manipulation library for X a
ii  libpng12-0             1.2.27-2+lenny4   PNG library - runtime
ii  librrd4                1.3.1-4           Time-series data storage and displ
ii  libx11-6               2:1.1.5-2         X11 client-side library
ii  libxcb-render-util0    0.2.1+git1-1      utility libraries for X C Binding 
ii  libxcb-render0         1.1-1.2           X C Binding, render extension
ii  libxcb1                1.1-1.2           X C Binding
ii  libxrender1            1:0.9.4-2         X Rendering Extension client libra
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

rrdtool recommends no packages.

Versions of packages rrdtool suggests:
ii  librrds-perl                  1.3.1-4    Time-series data storage and displ

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to