[rrd-developers] MRTG , Segmentation Fault , After re-installing perl .

Mr. James W. Laferriere babydr at baby-dragons.com
Fri Feb 13 05:09:08 CET 2009


 	Hello All ,  Following is a transcript that I posted to Steve Shipway's 
blog on routers2.cgi .  What follows should( hopefully) be enough help someone 
to give me some pointers of where I am going wrong .
 		Tia ,  JimL


 	It's best to goto this Url on Steve's wiki .  Url: to the post .
http://www.steveshipway.org/forum/viewtopic.php?f=2&t=1733&start=0&st=0&sk=t&sd=a


<<< PostPosted: Fri 06 Feb, 2009 3:12 pm >>>
 	Does anyone have any ideas for me to check on that maybe causing this ?

 	rrdtool [info|fetch] work fine on the example .cfg's .rrd file .
 	routers2.cgi reports itself in good health on the offending *.cfg as well .

 	From below my best guess is that hte segfault is happening in the line with 'RRDs::updatev' .
 	And of course I am way over my head with trying to trace that down .

 	Even even after upgrading to mrtg-2.16.2 , we still get a segfault .

 	Tia , JimL

 	I editted a copy of mrtg to help find the area after the last debug
 	logged , See below , ...

<diff>
--- /usr/local/mrtg-2/bin/mrtg-workingon 2009-02-06 10:05:23.000000000 -0900
+++ /usr/local/mrtg-2/bin/mrtg 2009-02-06 09:58:37.000000000 -0900
@@ -845,22 +845,18 @@
warn "$NOW: ERROR: Cannot tune logfile: $e\n" if $e;
}
# update the rrd
$inlast = 'U' unless defined $inlast and $inlast =~ /\S/ and $inlast ne '##UNDEF##';
$outlast = 'U' unless defined $outlast and $outlast =~ /\S/ and $outlast ne '##UNDEF##';
-#
 	debug('log', "RRDs::update($dotrrd, '$time:$inlast:$outlast')");
 	my $start = gettimeofday();
 	my $rrddata;
 	if ( $RRDs::VERSION >= 1.2 ){
-#
 	$rrddata=RRDs::updatev($dotrrd, "$time:$inlast:$outlast");
} else {
-#
 	RRDs::update($dotrrd, "$time:$inlast:$outlast");
}
-#
 	debug('prof',sprintf("RRDs::update $dotrrd - %.3fs",gettimeofday()-$start));
 	my $e = RRDs::error();
 	warn "$NOW: ERROR: Cannot update $dotrrd with '$time:$inlast:$outlast' $e\n" if ($e);

 	if ( $RRDs::VERSION < 1.2 ){
</diff>


 	Yes when it segfaults it doesn't do any cleanup .
# rm /var/www/htdocs/router2cgi/cfg/*_l_*

# /usr/local/mrtg-2/bin/mrtg --debug="base,snpo,snpo2,coca,repo,fork,time,log,eval,prof" /var/www/htdocs/router2cgi/cfg/to-rtr01.cfg >> ~/mrtg-the-last-area-before-segfault.log 2>&1

--time: prog start Fri Feb 6 10:07:31 2009
--base: Creating Lockfiles /var/www/htdocs/router2cgi/cfg/to-rtr01.cfg_l,/var/www/htdocs/router2cgi/cfg/to-rtr01.cfg_l_7765
--base: Reading Config File: /var/www/htdocs/router2cgi/cfg/to-rtr01.cfg
--base: Reading Interface Config cache
--base: Checking Config File
--base: Loading RRD support
--base: Loading default Locale
--base: Starting main Loop
--time: loop start Fri Feb 6 10:07:31 2009
--base: Populate Target object by polling SNMP and external Datasources
--time: snmp read start Fri Feb 6 10:07:31 2009
--snpo: run snmpget from ifInOctets&ifOutOctets:6f4 at I#NB$@to-rtr01
--snpo: simple If: .1
--snpo: simple If: .1
--snpo: SNMPGet from 6f4 at I#NB$@to-rtr01: -- ifInOctets.1,ifOutOctets.1
--snpo: SNMPfound -- '517463880', '3391376386'
--snpo: run snmpget from ifInOctets&ifOutOctets:6f4 at I#NB$@to-rtr01
--snpo: simple If: .2
--snpo: simple If: .2
--snpo: SNMPGet from 6f4 at I#NB$@to-rtr01: -- ifInOctets.2,ifOutOctets.2
--snpo: SNMPfound -- '3137038639', '254183055'
--snpo: run snmpget from .1.3.6.1.2.1.2.2.1.14&.1.3.6.1.2.1.2.2.1.20:6f4 at I#NB$@to-rtr01
--snpo: simple If: .1
--snpo: simple If: .1
--snpo: SNMPGet from 6f4 at I#NB$@to-rtr01: -- .1.3.6.1.2.1.2.2.1.14.1,.1.3.6.1.2.1.2.2.1.20.1
--snpo: SNMPfound -- '16954', 'undef'
--snpo: run snmpget from .1.3.6.1.2.1.2.2.1.14&.1.3.6.1.2.1.2.2.1.20:6f4 at I#NB$@to-rtr01
--snpo: simple If: .2
--snpo: simple If: .2
--snpo: SNMPGet from 6f4 at I#NB$@to-rtr01: -- .1.3.6.1.2.1.2.2.1.14.2,.1.3.6.1.2.1.2.2.1.20.2
--snpo: SNMPfound -- 'undef', 'undef'
--time: target loop start Fri Feb 6 10:07:31 2009
--base: Act on Router/Target to-rtr01_1
--base: Get Current values: in:517463880, out:3391376386, up:undef, name:undef, time:1233947251
--base: Create Graphics
--base: start RRDtool section
--base: maxi:48000, maxo:48000
--log: RRDs::tune(/var/www/htdocs/router2cgi/graphs/to-rtr01/to-rtr01_1.rrd -a ds0:48000 -a ds1:48000 -d ds0:COUNTER -d ds1:COUNTER)
--prof: RRDs::tune /var/www/htdocs/router2cgi/graphs/to-rtr01/to-rtr01_1.rrd - 0.000s
--log: RRDs::update(/var/www/htdocs/router2cgi/graphs/to-rtr01/to-rtr01_1.rrd, '1233947251:517463880:3391376386')
Segmentation fault

# tail -1 /var/log/messages
Feb 6 10:07:31 dsb-mntr01 kernel: mrtg[7765]: segfault at 00000001 eip b7e3922b esp bfbfeb40 error 4

 	List of tools ...

Not that this is the culprit , but ...
routers2-v2.20-Beta4

Even mrtg-2.16.2 causes a segfault .

# head /usr/local/mrtg-2/bin/mrtg
#! /usr/local/bin/perl -w
# -*- mode: cperl -*-

###################################################################
# MRTG 2.16.1 Multi Router Traffic Grapher
###################################################################
# Created by Tobias Oetiker <tobi at oetiker.ch>
# and Dave Rand <dlr at bungi.com>

# rrdtool --version
RRDtool 1.3.6 Copyright 1997-2008 by Tobias Oetiker <tobi at oetiker.ch>
Compiled Feb 6 2009 09:28:18

# perl --version

This is perl, v5.10.0 built for i686-linux

Copyright 1987-2007, Larry Wall


<<< PostPosted: Fri 06 Feb, 2009 6:02 pm >>>

 	Hello all , Well an strace isn't shedding any good light on the
 	difficulty(ies) .
 	Seems fcntl64 (a kernel item) mzay be the culprit . I haven't updated
 	the kernel . Tho I probably should (eventually) . Tho it could be the
 	next call to 'something' that is actually failing , But I am not able to
 	acquire that readily .

 	Again any hints on where to look please pipe up .

 	Tia , JimL


# strace -f /usr/local/mrtg-2/bin/mrtg 
--debug="base,snpo,snpo2,coca,repo,fork,time,log,eval,prof" 
/var/www/htdocs/router2cgi/cfg/to-rtr01.cfg 2>&1 | tee 
~/strace-mrtg-the-last-area-before-segfault.log


# tail -20 ~/strace-mrtg-the-last-area-before-segfault.log
write(2, "--prof: RRDs::tune /var/www/htdo"..., 86--prof: RRDs::tune /var/www/htdocs/router2cgi/graphs/to-rtr01/to-rtr01_1.rrd - 0.002s) = 86
write(2, "--log: RRDs::update(/var/www/htd"..., 114--log: RRDs::update(/var/www/htdocs/router2cgi/graphs/to-rtr01/to-rtr01_1.rrd, '1233956397:553429700:3414135629')) = 114
gettimeofday({1233956398, 821161}, NULL) = 0
open("/var/www/htdocs/router2cgi/graphs/to-rtr01/to-rtr01_1.rrd", O_RDWR) = 5
utime("/var/www/htdocs/router2cgi/graphs/to-rtr01/to-rtr01_1.rrd", NULL) = 0
fstat64(5, {st_mode=S_IFREG|0674, st_size=94584, ...}) = 0
fadvise64(5, 0, 0, POSIX_FADV_RANDOM) = 0
mmap2(NULL, 94584, PROT_READ|PROT_WRITE, MAP_SHARED, 5, 0) = 0xb7cc0000
madvise(0xb7cc0000, 94584, 0x1 /* MADV_??? */) = 0
madvise(0xb7cc0000, 112, MADV_SEQUENTIAL|0x1) = 0
madvise(0xb7cc0000, 240, MADV_SEQUENTIAL|0x1) = 0
madvise(0xb7cc0000, 864, MADV_SEQUENTIAL|0x1) = 0
madvise(0xb7cc0000, 8, MADV_SEQUENTIAL|0x1) = 0
gettimeofday({1233956398, 823497}, NULL) = 0
fcntl64(5, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 6293 detached


<<< PostPosted: Wed 11 Feb, 2009 5:39 pm >>>
 	Hello Steve ,

 	Fyi (only) I have to stand corrected the plain RRDs::update works fine .

 	I'll try to get this thread to the lists you mentioned .
 	Thank you . JimL


-- 
+------------------------------------------------------------------+
| James   W.   Laferriere | System    Techniques | Give me VMS     |
| Network&System Engineer | 2133    McCullam Ave |  Give me Linux  |
| babydr at baby-dragons.com | Fairbanks, AK. 99701 |   only  on  AXP |
+------------------------------------------------------------------+



More information about the rrd-developers mailing list