|
Home > Archive > Debian Developers > January 2006 > How to debug - apachetop
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to debug - apachetop
|
|
| Alejandro Bonilla 2006-01-13, 10:44 pm |
| Hi,
After the actual error I got with apachetop:
debian:~# apachetop -f /var/log/apache/access.log
*** glibc detected *** free(): invalid pointer: 0xb7da08c8 ***
Aborted
I want to learn how to debug and see what went wrong. How can I learn to debug
this kind of things or how can I enable some debugging for this kind of things?
Thanks,
..Alejandro
--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
| |
| Florian Weimer 2006-01-13, 10:44 pm |
| * Alejandro Bonilla:
> I want to learn how to debug and see what went wrong. How can I
> learn to debug this kind of things or how can I enable some
> debugging for this kind of things?
valgrind is quite helpful for debugging such problems related to
memory-management. You could also have a look at mtrace.
--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
| |
| Nico Golde 2006-01-13, 10:44 pm |
| Hi,
* Alejandro Bonilla <abonilla@linuxwireless.org> [2006-01-11 19:03]:
> After the actual error I got with apachetop:
> debian:~# apachetop -f /var/log/apache/access.log
> *** glibc detected *** free(): invalid pointer: 0xb7da08c8 ***
> Aborted
>
> I want to learn how to debug and see what went wrong. How can I learn to debug
> this kind of things or how can I enable some debugging for this kind of things?
If you dont know how to debug this (for example with gdb)
please write a bug report using `reportbug apachetop` and
hopefully the maintainer will tell you how to assemble more
information.
Kind regards
Nico Golde
--
Nico Golde - JAB: nion@jabber.ccc.de | GPG: 0x73647CFF
http://www.ngolde.de | http://www.muttng.org | http://grml.org
Forget about that mouse with 3/4/5 buttons -
gimme a keyboard with 103/104/105 keys!
| |
| Steve Kemp 2006-01-13, 10:44 pm |
| On Wed, Jan 11, 2006 at 11:10:51AM -0600, Alejandro Bonilla wrote:
> After the actual error I got with apachetop:
> debian:~# apachetop -f /var/log/apache/access.log
> *** glibc detected *** free(): invalid pointer: 0xb7da08c8 ***
> Aborted
>
> I want to learn how to debug and see what went wrong. How can I learn to debug
> this kind of things or how can I enable some debugging for this kind of things?
Mostly this invokes recompiling the application to make sure it
has debugging symbols.
As the package maintainer I took a look at this, and found a possible
bug. Here's how I did it.
(I just noticed there is a bug report showing the same error reported
a few days ago. I posted a followup asking for more information, as
I hadn't seen it myself until now.)
OK. So we get the application and run it under gdb:
root@itchy:~# gdb apachetop
GNU gdb 6.4-debian
Copyright 2005 Free Software....
....
Type "r" to run the application:
(gdb) r
Starting program: /usr/sbin/apachetop
(no debugging symbols found)
*** glibc detected *** free(): invalid pointer: 0xb7e448c0 ***
Program received signal SIGABRT, Aborted.
0xb7d397a7 in raise () from /lib/tls/libc.so.6
Here we see two things: There are no debugging symbols and we managed
to see the crash.
Rebuilding with debugging enabled we can try again:
root@itchy:~# gdb ./debian/sid/apachetop/apachetop-0.12.5/src/apachetop
GNU gdb 6.4-debian
....
(gdb) r
Starting program:
/home/skx/debian/sid/apachetop/apachetop-0.12.5/src/apachetop
*** glibc detected *** free(): invalid pointer: 0xb7e448c0 ***
Program received signal SIGABRT, Aborted.
0xb7d397a7 in raise () from /lib/tls/libc.so.6
Type "up" a few times to move up the call stack and see if we
can see where it dies:
(gdb) up
#1 0xb7d3b04b in abort () from /lib/tls/libc.so.6
(gdb) up
#2 0xb7d70015 in __fsetlocking () from /lib/tls/libc.so.6
(gdb) up
#3 0xb7d76667 in malloc_usable_size () from /lib/tls/libc.so.6
(gdb) up
#4 0xb7d76b02 in free () from /lib/tls/libc.so.6
(gdb) up
#5 0x0804a15f in new_file (filename=0x804f5b9
"/var/log/apache2/access.log",
do_seek_to_end=true) at apachetop.cc:1029
1029 if (this_file->filename)
free(this_file->filename);
Ahah!
We see there is an error in free, and it was caused by the line
"if (this_file->filename) free (this_file->filename)".
Comment that line of the program out, and rebuild it.
No more crash!
That's Steve's patented introduction to solving an Apachetop crash
with gdb ;)
Seriously using the application under the debugger is the most obvious
way to look for bugs for me. Valgrind, strace, etc, are very good
at what they do. But if you can rebuild your application to use
debugging symbols then using gdb is simple enough. There are tutorials
on getting started which google will help you find.
I'll try to see where the filename is getting setup and what is
wrong with it. Might take me a day or two, but as a quick fix you
can safely comment out/delete the free line and just suffer a small
memory leak for the moment.
Steve
--
--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
|
|
|
|
|