Am 14.03.2014 18:11, schrieb Jorge Bastos:
> You have to compile dbmail with debug

not always needed, the script below made the imapd-backtrace
on our production server which has fore sure stripped binaries
with no debug or minidebug infos and there where dbmail functions

*please* use that script, we need the backtrace of the
single connection consuming CPU and not the main process

the result is a backtrace file named by the thread-ID but since
there is no thread here with more than 20% CPU only the top output

[root@mail:/Volumes/dune/debug]$ cat dbmail-debug-top.txt
top - 18:44:22 up 7 days, 23:29,  1 user,  load average: 0,01, 0,05, 0,05
Threads:   2 total,   0 running,   2 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0,5 us,  0,2 sy,  0,0 ni, 98,9 id,  0,2 wa,  0,1 hi,  0,1 si,  0,0 st
KiB Mem:  10502276 total,  8549272 used,  1953004 free,   221896 buffers
KiB Swap:        0 total,        0 used,        0 free,   926848 cached

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
22456 dbmail    20   0  198380  17800   4808 S  0,0  0,2   0:11.51 dbmail-pop3d
22458 dbmail    20   0  198380  17800   4808 S  0,0  0,2   0:00.00 dbmail-pop3d
______________________________________________________________________________

[root@mail:/Volumes/dune/debug]$ cat debug-pop3.sh
#!/usr/bin/bash

cd /Volumes/dune/debug/
rm -f dbmail-debug-*.txt

top -H -b -n1 -p `pidof dbmail-pop3d` > dbmail-debug-top.txt
MAXCPU=20
# get the PID
MAIN_PID=`pidof dbmail-pop3d`
# find busy threads
BUSY=`top -H -b -n1 -p $MAIN_PID|grep 'pool'|awk '{if ($9 > $MAXCPU)
print $1}'|head -1`
if [ -n "$BUSY" ]; then
  # generate a gdb commandfile
  tmpfile=`mktemp`
  echo 'bt' > $tmpfile
  # get a backtrace
  gdb --batch -x $tmpfile -p $BUSY > dbmail-debug-backtrace.$BUSY.txt
  rm -f $tmpfile
fi
______________________________________________________________________________

as you can see in the "ps aux" output there is only once process
the prolem most likely is not in PID 22456 but in PID 22458

[root@mail:/Volumes/dune/debug]$ ps aux | grep pop3d
dbmail   22456  0.0  0.1 198380 17500 ?        Ssl  14:54   0:11 
/usr/sbin/dbmail-pop3d -D

>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On
>> Behalf Of James Greig
>> Sent: sexta-feira, 14 de Março de 2014 17:11
>> To: DBMail mailinglist
>> Subject: Re: [Dbmail] Iphone HTML emails
>>
>> Scratch that.  But doesn't seem no matter what I do this is the only
>> output I ever get when doing bt or bt full on pop3d
>>
>> (gdb) bt
>> #0  0x0000000803ed64dc in ?? () from /lib/libthr.so.3
>> #1  0x0000000803ed07b5 in ?? () from /lib/libthr.so.3
>> #2  0x0000000803ed88ed in ?? () from /lib/libthr.so.3
>> #3  0x0000000802df2b15 in doSweep () from /usr/local/lib/libzdb.so.9
>> #4  0x0000000803eced34 in ?? () from /lib/libthr.so.3
>> #5  0x0000000000000000 in ?? ()
>> (gdb) bt
>> #0  0x0000000803ed64dc in ?? () from /lib/libthr.so.3
>> #1  0x0000000803ed07b5 in ?? () from /lib/libthr.so.3
>> #2  0x0000000803ed88ed in ?? () from /lib/libthr.so.3
>> #3  0x0000000802df2b15 in doSweep () from /usr/local/lib/libzdb.so.9
>> #4  0x0000000803eced34 in ?? () from /lib/libthr.so.3
>> #5  0x0000000000000000 in ?? ()
>> (gdb) bt full
>> #0  0x0000000803ed64dc in ?? () from /lib/libthr.so.3 No symbol table
>> info available.
>> #1  0x0000000803ed07b5 in ?? () from /lib/libthr.so.3 No symbol table
>> info available.
>> #2  0x0000000803ed88ed in ?? () from /lib/libthr.so.3 No symbol table
>> info available.
>> #3  0x0000000802df2b15 in doSweep () from /usr/local/lib/libzdb.so.9 No
>> symbol table info available.
>> #4  0x0000000803eced34 in ?? () from /lib/libthr.so.3 No symbol table
>> info available.
>> #5  0x0000000000000000 in ?? ()
>> No symbol table info available.
>>
>> I imagine I'm doing something completely wrong here=/
>>
>> Best regards,
>>
>> James Greig
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On
>> Behalf Of James Greig
>> Sent: 14 March 2014 16:12
>> To: DBMail mailinglist
>> Subject: Re: [Dbmail] Iphone HTML emails
>>
>> Eugh.  Wish it was that easy for me but unfortunately this is freebsd
>> which will mean kernel rebuilds etc by the looks of it.  Running gdb -p
>> XXXX requires ptrace drivers.
>>
>> Best regards,
>>
>> James Greig
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On
>> Behalf Of Reindl Harald
>> Sent: 14 March 2014 15:41
>> To: [email protected]
>> Subject: Re: [Dbmail] Iphone HTML emails
>>
>>
>> Am 14.03.2014 16:31, schrieb James Greig:
>>> Just happened again so I've killed pop3d and started with gdb
>>
>> oh no - the stop makes the problem go away try the script below and
>> replace "imapd" with "pop3d"
>> the idea behind is find the *thread* which hangs and backtrace that one
>>
>> that was used to find "Fixed critical spinlock when appending empty
>> string"
>> http://git.dbmail.eu/paul/dbmail/commit/?h=dbmail_3_1&id=b93924f9238506
>> ea69dc23c66898ddaa9380e36d
>> _______________________________________________________
>>
>> #!/bin/bash
>> MAXCPU=20
>> IMAPPID=`pidof dbmail-imapd`
>> # find busy threads
>> BUSY=`top -H -b -n1 -p $IMAPPID|grep 'pool'|awk '{if ($9 > $MAXCPU)
>> print $1}'|head -1` if [ -n "$BUSY" ]; then
>>   # generate a gdb commandfile
>>   tmpfile=`mktemp`
>>   echo 'bt' > $tmpfile
>>   # get a backtrace
>>   gdb --batch -x $tmpfile -p $BUSY > dbmail-debug-backtrace.$BUSY.txt
>>   rm -f $tmpfile
>> fi

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to