Jason A. Smith wrote:
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.

Woohoo!  My code stinks!  :)

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.

Are you sure that the extra values are on a new line?  On my 2.4.3 kernel,
/proc/net/dev has one line per interface, period. The transmit section is similar to the receive section but has "colls" and "carrier" instead of "frame" (i.e. one extra field)... (I've tested on 2.4.3 and 2.4.18)

I guess I could put in an "or end-of-file" in there somewhere...

It's also possible (but unlikely) that you're using a kernel that has somehow changed the formatting in procfs. In which case you'll need some linux.c code that behaves differently "if (kernel_version == 'Funky Dev Kernel')" ... :)

Anyone have any ideas?  I appended a short gdb log below showing the
stack trace and the problem variables.

See above for ideas. Thanks for the log, though, it helps to see /proc/net/dev ...


Reply via email to