Lately I have been trying out the new gmond code from cvs and have been
getting crashes several hours after starting it. Recently I ran it in
gdb so I could catch the error and found that it is crashing in the
pkts_out_func() function: monitor-core/gmond/machines/linux.c:167. It
appears that there is a stray 0 all alone on the last line of the
/proc/net/dev buffer. I don't have any idea how that got there, but
that is what caused the crash since the line right before that calls the
index function to look for the colon and just assumes that it will get
back a valid pointer, which returns NULL this time.
The real cause of the crash is of course the lone zero at the end of the
file buffer, but I have no idea how that got there. It looks like
update_file just calls slurpfile which just does a simple open and read
into the buffer.
Anyone have any ideas? I appended a short gdb log below showing the
stack trace and the problem variables.
~Jason
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 5126 (LWP 19828)]
0x0804d1fd in pkts_out_func () at machine.c:167
167 if ( (*p-1 != 'o') && (*p-2 != 'l') )
(gdb) where
#0 0x0804d1fd in pkts_out_func () at machine.c:167
#1 0x0804ab95 in set_metric_value (key=31) at monitor.c:182
#2 0x0804a93d in monitor_thread (arg=0x0) at monitor.c:129
#3 0x40050c6f in pthread_start_thread (arg=0x40bacbe0) at manager.c:284
#4 0x40050d5f in pthread_start_thread_event (arg=0x40bacbe0) at
manager.c:308
(gdb) print p
$1 = 0x1 <Address 0x1 out of bounds>
(gdb) printf "%s", proc_net_dev.buffer
Inter-| Receive |
Transmit
face |bytes packets errs drop fifo frame compressed
multicast|bytes packets errs drop fifo colls carrier compressed
lo: 735841 8433 0 0 0 0 0 0
735841 8433 0 0 0 0 0 0
eth0: 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
eth1:82056844 100416551 0 0 0 0 0 765884
3806693211 89047873 0 0 0 0 0 0
eth2:1758896984 21917526 0 0 0 0 0 5712707
2463675100 23055587 0 0 0 0 0 0
0
(gdb)
--
/------------------------------------------------------------------\
| Jason A. Smith Email: [EMAIL PROTECTED] |
| Atlas Computing Facility Phone: (631)344-4226 |
| Brookhaven National Lab, Bldg. 510M Fax: (631)344-7616 |
| Upton, NY 11973-5000 |
\------------------------------------------------------------------/