[OpenAFS] 1.3.80 server strangeness (kernel 2.6.11-gentoo-r3)
Joshua Johnson
joshua.johnson@ftlsys.com
Fri, 25 Mar 2005 15:11:52 -0600
On Friday 25 March 2005 13:37, Derrick J Brashear wrote:
> On Fri, 25 Mar 2005, Kevin wrote:
> >>> *** glibc detected *** free(): invalid pointer: 0xb7c9c010 ***
> >>
> >> So you're hitting a bug which killed the bosserver. I wonder if purify
> >> would help, and who has a license these days.
> >
> > I just Googled for purify... Would that be something that I would run
> > (as opposed to some genius developer guy like you) to try and locate the
> > bug? So am I the only one seeing this problem? Geez... what's so odd
> > about my setup...
>
> probably a different glibc version or somesuch, luck of the draw. the
> person who suggested valgrind might have a point but i have never tried
> it.
FWIW, I have found it worthwile to try on other projects. Nothing against
Purify, but this is GPL, and doesn't need to be compiled-in, so end-users can
run it, but it is x86-Linux only.
Generally run as:
>valgrind [options] <target binary and args >
For this type of bug it should be straightforward to use.
Here is the 30 second introduction to Valgrind.....
I just downloaded the latest src and compiled on RH9 (Dual -933Mhz) in
~3-5min.
Compiled
==============================================
#include <stdio.h>
#include <malloc.h>
void leaky(int** inptr){
int* myint2 = malloc(sizeof(int));
*inptr = 0;
}
int main (void){
int testint;
int* myint = malloc(sizeof(int));
int* myfreeint = (int*)0xDEADBEEF;
printf("Hello World \n");
free(myfreeint);
leaky(&myint);
testint = *myint;
exit(0);
}
====================================
>valgrind --leak-check=full a.out
==7843== Memcheck, a memory error detector for x86-linux.
==7843== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==7843== Using valgrind-2.4.0, a program supervision framework for x86-linux.
==7843== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==7843== For more details, rerun with: -v
==7843==
Hello World
==7843== Invalid free() / delete / delete[]
==7843== at 0x1B903A45: free (vg_replace_malloc.c:152)
==7843== by 0x8048426: main (in /usr/local/src/a.out)
==7843== Address 0xDEADBEEF is not stack'd, malloc'd or (recently) free'd
==7843==
==7843== Invalid read of size 4
==7843== at 0x804843C: main (in /usr/local/src/a.out)
==7843== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==7843==
==7843== Process terminating with default action of signal 11 (SIGSEGV)
==7843== Access not within mapped region at address 0x0
==7843== at 0x804843C: main (in /usr/local/src/a.out)
==7843==
==7843== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 13 from 1)
==7843== malloc/free: in use at exit: 8 bytes in 2 blocks.
==7843== malloc/free: 2 allocs, 1 frees, 8 bytes allocated.
==7843== For counts of detected errors, rerun with: -v
==7843== searching for pointers to 2 not-freed blocks.
==7843== checked 57344 bytes.
==7843==
==7843==
==7843== 4 bytes in 1 blocks are definitely lost in loss record 1 of 2
==7843== at 0x1B903534: malloc (vg_replace_malloc.c:130)
==7843== by 0x80483D3: leaky (in /usr/local/src/a.out)
==7843== by 0x8048435: main (in /usr/local/src/a.out)
==7843==
==7843==
==7843== 4 bytes in 1 blocks are definitely lost in loss record 2 of 2
==7843== at 0x1B903534: malloc (vg_replace_malloc.c:130)
==7843== by 0x80483FE: main (in /usr/local/src/a.out)
==7843==
==7843== LEAK SUMMARY:
==7843== definitely lost: 8 bytes in 2 blocks.
==7843== possibly lost: 0 bytes in 0 blocks.
==7843== still reachable: 0 bytes in 0 blocks.
==7843== suppressed: 0 bytes in 0 blocks.
==7843== Reachable blocks (those to which a pointer was found) are not shown.
==7843== To see them, rerun with: --show-reachable=yes
Segmentation fault
=====================================================
You'll need symbols in the binary for user meaningful output.
The "==7843==" is the pid, it's the prefix to valgrind output, you can also
log this data to a file (recommend) with the --log-file= option.
HTH,
Josh