[rrd-developers] rrdtool segfault

Matt Scifo mscifo at o1.com
Tue Jan 13 18:46:25 MET 2004


Hello

I have a multi-threaded application, where each thread calls
rrd_update().  At any given time, there are at least 125 threads running
in parallel.  Each thread is responsible for calling rrd_update() using
the following code...

update(string filename, string datasources, string values)
{
    char *argv[6];

    // add -t argument to datasources
    datasources = "-t" + datasources;

    // RRD library call
    argv[0] = "update";
    argv[1] = (char *)filename.c_str();
    argv[2] = (char *)datasources.c_str();
    argv[3] = (char *)values.c_str();
    // Ex. argv = "update file.rrd -tDS1 N:U"

    optind = 0;
    opterr = 0;
    if (rrd_update(4, argv) == -1)
        results.push_back(rrd_get_error());
    else
        results.push_back("success");
    rrd_clear_error();
}

At random times, the application segfaults, always returning the same
backtrace.  Here is the gdb backtrace...

#0  0x40101609 in confstr () from /lib/libc.so.6
#1  0x4010237c in getopt_long () from /lib/libc.so.6
#2  0x4002d2c4 in rrd_update () from /usr/lib/librrd.so.0

I have read previous threads regarding the same problem, and they 
all indicate that it is necessary to clear the global vars optind
and opterr before each call.  As you can see above, I have done this,
yet I am still receiving segfaults.

I am running on RH8.0 with RRD 1.0.45.

Can anyone provide any help?

Thanks

-Matt Scifo

--
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://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-developers mailing list