Re: [Hampshire] Debugging pipes

Top Page

Reply to this message
Author: Chris Sykes
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Debugging pipes
James Courtier-Dutton wrote:
> Hi,
>
> I have an email system based on fetchmail->exim->cyrus-imap.
> Some emails get caught in the queue and never get delivered.
> It appears that the process in cyrus-imap receiving the email crashes.
> Unfortunately, I do not get any stack trace or any information as to
> why it failed.
> If I run exim and cyrus-imap inside gdb, this also does not help, as
> the process used to do the receive into cyrus looks like a fork or
> exec from the cyrus-imap process, and gdb does not attach to them.
>
> Does anyone have any idea of how I can track this down a bit more?


Rather than running the processes under gdb, you could try enabling core
dumps for the processes in question. 'ulimit -c unlimited' will do it
for the current session, or take a look in /etc/security/limits.conf.
When a process crashes it should leave a 'core' dump file. Then simply
run gdb on the executable in question and load the core file to get the
backtrace. e.g.:

csykes@eeek:~$ ./crash
Floating point exception (core dumped)
csykes@eeek:~$ gdb ./crash
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) core core
warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./crash'.
Program terminated with signal 8, Arithmetic exception.
#0  0x080483cb in main () at crash.c:5
5               printf("This will cause a FPE: %f\n", x/y);


Regards,

Chris.