Package: rrdtool
Version: 1.4.7-2
Severity: minor

Dear Maintainer,

I attach a python script to quickly setup the rrd archieve in current directory
(requires python-rrdtool). To get a segfault just run the script with
"python crash_rrd.py"
and then
"rrdtool fetch test.rrd AVERAGE".

The problem is in type of RRA I use in line 14:
'RRA:AVERAGE:0.5:1:36500'
It means that last entry will be somewhere in 100 years.
If I use something that fits in unixtime (not 100 * 265, but 20 * 365),
everything works fine.

The script and gdb output attached.


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

Kernel: Linux 3.8-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages rrdtool depends on:
ii  libc6          2.17-7
ii  libcairo2      1.12.2-3
ii  libdbi1        0.8.4-6
ii  libglib2.0-0   2.33.12+really2.32.4-5
ii  libpango1.0-0  1.30.0-1
ii  libpng12-0     1.2.49-4
ii  librrd4        1.4.7-2
ii  libxml2        2.8.0+dfsg1-7+nmu1

rrdtool recommends no packages.

Versions of packages rrdtool suggests:
pn  librrds-perl  <none>

-- no debconf information
import rrdtool, datetime, calendar

rrdtool.create('test.rrd', '--step', '86400',
                'DS:test:GAUGE:172800:0:U',
                'DS:test2:GAUGE:172800:0:U',
                'DS:test3:GAUGE:172800:0:U',
                'DS:test4:GAUGE:172800:0:U',
                'DS:test5:GAUGE:172800:0:U',
                'DS:test6:GAUGE:172800:0:U',
                'DS:test7:GAUGE:172800:0:U',
                'DS:test8:GAUGE:172800:0:U',
                'DS:test9:GAUGE:172800:0:U',
                'DS:test10:GAUGE:172800:0:U',
                'RRA:AVERAGE:0.5:1:36500')

now = datetime.datetime.now()
for i in range(365 * 20):
    time = calendar.timegm(now.timetuple())
    update_str = '{0}:{1}:2:3:4:5:6:7:8:9:{2}'.format(time, i, i)
    rrdtool.update('test.rrd', update_str)
    now += datetime.timedelta(days=1)
Starting program: /usr/bin/rrdtool fetch test.rrd AVERAGE
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library 
"/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
rrd_fetch_fn (filename=<optimized out>, filename@entry=0xbffff559 "test.rrd", 
cf_idx=CF_AVERAGE, start=start@entry=0xbffff1d8, end=end@entry=0xbffff1dc, 
    step=step@entry=0xbffff1e0, ds_cnt=ds_cnt@entry=0xbffff1e4, 
ds_namv=ds_namv@entry=0xbffff1f0, data=data@entry=0xbffff1e8) at rrd_fetch.c:415
415     rrd_fetch.c: Нет такого файла или каталога.
#0  rrd_fetch_fn (filename=<optimized out>, filename@entry=0xbffff559 
"test.rrd", cf_idx=CF_AVERAGE, start=start@entry=0xbffff1d8, 
end=end@entry=0xbffff1dc, 
    step=step@entry=0xbffff1e0, ds_cnt=ds_cnt@entry=0xbffff1e4, 
ds_namv=ds_namv@entry=0xbffff1f0, data=data@entry=0xbffff1e8) at rrd_fetch.c:415
        i = -18922
        ii = <optimized out>
        cal_start = <optimized out>
        cal_end = <optimized out>
        rra_start_time = -1149724800
        rra_end_time = 2003788800
        best_full_rra = 0
        best_part_rra = 0
        chosen_rra = 0
        rra_pointer = 5538
        best_full_step_diff = 2003788800
        best_part_step_diff = 0
        tmp_step_diff = <optimized out>
        tmp_match = <optimized out>
        best_match = 0
        full_match = <optimized out>
        rra_base = 3352
        start_offset = -18922
        end_offset = 7298
        first_full = 3352
        first_part = -1149724800
        rrd = {stat_head = 0xb6f55000, ds_def = 0xb6f55070, rra_def = 
0xb6f55520, live_head = 0xb6f5558c, legacy_last_up = 0x0, pdp_prep = 
0xb6f55594, 
          cdp_prep = 0xb6f559f4, rra_ptr = 0xb6f55d14, rrd_value = 0x0}
        rrd_file = 0x8050d28
        data_ptr = 0x8070000
        rows = <optimized out>
#1  0xb7f91470 in rrd_fetch_r (filename=0xbffff559 "test.rrd", cf=0xbffff562 
"AVERAGE", start=start@entry=0xbffff1d8, end=end@entry=0xbffff1dc, 
    step=step@entry=0xbffff1e0, ds_cnt=ds_cnt@entry=0xbffff1e4, 
ds_namv=ds_namv@entry=0xbffff1f0, data=data@entry=0xbffff1e8) at rrd_fetch.c:201
        cf_idx = <optimized out>
#2  0xb7f917bb in rrd_fetch (argc=argc@entry=3, argv=argv@entry=0xbffff3c8, 
start=start@entry=0xbffff1d8, end=end@entry=0xbffff1dc, 
step=step@entry=0xbffff1e0, 
    ds_cnt=ds_cnt@entry=0xbffff1e4, ds_namv=ds_namv@entry=0xbffff1f0, 
data=data@entry=0xbffff1e8) at rrd_fetch.c:176
        step_tmp = 1
        start_tmp = 1373085664
        end_tmp = 1373172064
        cf = <optimized out>
        opt_daemon = 0x0
        status = 0
        start_tv = {type = RELATIVE_TO_END_TIME, offset = -86400, tm = {tm_sec 
= 0, tm_min = 0, tm_hour = 0, tm_mday = 0, tm_mon = 0, tm_year = 0, tm_wday = 
0, 
            tm_yday = 187, tm_isdst = -1, tm_gmtoff = 18000, tm_zone = 
0x8050d08 "UZT"}}
        end_tv = {type = ABSOLUTE_TIME, offset = 0, tm = {tm_sec = 4, tm_min = 
41, tm_hour = 9, tm_mday = 7, tm_mon = 6, tm_year = 113, tm_wday = 0, tm_yday = 
187, 
            tm_isdst = 0, tm_gmtoff = 18000, tm_zone = 0x8050d08 "UZT"}}
        parsetime_error = <optimized out>
        long_options = {{name = 0xb7fb6399 "resolution", has_arg = 1, flag = 
0x0, val = 114}, {name = 0xb7fb71c1 "start", has_arg = 1, flag = 0x0, val = 
115}, {
            name = 0xb7fb71cd "end", has_arg = 1, flag = 0x0, val = 101}, {name 
= 0xb7fb50cf "daemon", has_arg = 1, flag = 0x0, val = 100}, {name = 0x0, 
has_arg = 0, 
            flag = 0x0, val = 0}}
#3  0x0804af05 in HandleInputLine (argc=argc@entry=4, 
argv=argv@entry=0xbffff3c4, out=0xb7af5980) at rrd_tool.c:693
        end = <optimized out>
        ii = <optimized out>
        ti = <optimized out>
        step = <optimized out>
        ds_cnt = <optimized out>
        data = <optimized out>
        start = <optimized out>
        i = <optimized out>
        datai = <optimized out>
        ds_namv = <optimized out>
        curdir = <optimized out>
        dent = <optimized out>
        st = {st_dev = 577881493259750456, __pad1 = 1, st_ino = 134548504, 
st_mode = 134548488, st_nlink = 134548472, st_uid = 134548456, st_gid = 
134548440, 
          st_rdev = 577873350001757128, __pad2 = 1616, st_size = 134547088, 
st_blksize = 134547576, st_blocks = 134547696, st_atim = {tv_sec = 134547920, 
            tv_nsec = -1214981816}, st_mtim = {tv_sec = 134547984, tv_nsec = 
134548040}, st_ctim = {tv_sec = 134548112, tv_nsec = 134548208}, __unused4 = 
134548272, 
          __unused5 = 134548320}
#4  0x08049303 in main (argc=4, argv=0xbffff3c4) at rrd_tool.c:523
        myargv = <optimized out>
        aLine = <optimized out>
        firstdir = 0x804ba4d ""
quit
A debugging session is active.

        Inferior 1 [process 7395] will be killed.

Quit anyway? (y or n) 

Reply via email to