Summary:ASTERISK-12473: crash when using asterisk db put
Reporter:Remi Quezada (remiq)Labels:
Date Opened:2008-07-28 13:15:40Date Closed:2009-02-27 16:38:59.000-0600
Versions:Frequency of
Environment:Attachments:( 0) gdbcore_2008-09-10.txt
( 1) gdbcore_2008-10-07.txt
( 2) gdbcore.3
( 3) gdbcore.output
( 4) gdbcore2.output
( 5) gdbcore3.output
Description:I have a macro that saves the sip CHANID to ast db when a call is answered so I can save this information to the CDR.  This seems to be causing asterisk to crash every once in a while when the CHANID variable is saved to the ast db.  This started to happen once I upgraded from 1.4.17 to  
Comments:By: snuffy (snuffy) 2008-07-28 16:26:02

Can you please upload both a bt and bt full when you compile asterisk with 'dont optimize'

By: Ken Leland (kenlee) 2008-07-29 09:59:49

This is occurring on a production system.  We would be happy to compile with 'dont optimize' on our development system but we do not know how to reliably reproduce this crash.  It occurred again last night and i have attached the core dump.

By: Tilghman Lesher (tilghman) 2008-07-29 10:18:16

You still have to compile with DONT_OPTIMIZE if you expect us to be able to help you.  This does not slow down Asterisk that much and is completely safe for production.

By: Tilghman Lesher (tilghman) 2008-08-07 11:31:19

One more thought:  what is the output of:
ls -l /var/lib/asterisk/astdb ?

By: Ken Leland (kenlee) 2008-08-07 11:43:46

[kenlee@sturgeon ~]$ ls -lh /var/lib/asterisk/astdb
-rw-r--r--  1 root root 92K Aug  7 12:49 /var/lib/asterisk/astdb

Also, we have been running with DONT_OPTIMIZE, so far no crash to report.

By: Remi Quezada (remiq) 2008-09-10 09:29:02

Server crashed last night.... I uploaded the latest core dump with 'dont optimize' flag.

By: Remi Quezada (remiq) 2008-09-25 08:29:15

Does anyone have any idea on how I can reproduce this crash based on the core dump provided?

By: Remi Quezada (remiq) 2008-10-08 10:54:16

Uploaded latest gdb core dump.  I've been getting consistent crashes every week or so.

By: Tilghman Lesher (tilghman) 2008-11-17 18:23:38.000-0600

remiq:  if it's occurring that often, you might want to follow the instructions in doc/valgrind.txt.

By: Leif Madsen (lmadsen) 2009-02-02 15:24:55.000-0600

remiq: are you going to be able to upload the valgrind trace to this issue? Without it I fear we cannot move this issue forward.

By: Remi Quezada (remiq) 2009-02-09 12:41:22.000-0600

We use MTTDial to write the sipcallid in our CDRs.  Based on gdb, asterisk is crashing because we are using astdb to temporary store the sipcallid.  Since this is very difficult to reproduce we decided not to write the sipcallid to the CDRs anymore.  Here are all the macros we use to accomplish this:

exten => s,1,Dial(${ARG1}|${ARG2}|M(savesipcallid,${ARG4})${ARG3})

exten => h,1,Macro(writesavedsipcallid)

exten => s,1,Set(DB(CHANID/${CHANNEL:4})=${SIPCALLID})
exten => s,n,GotoIf(${ARG1}?HASMODE:DEFAULT)
exten => s,n(HASMODE),GotoIf($[ ${ARG1} = rfc2833]?SETRFC:DEFAULT)
exten => s,n(SETRFC),SIPDtmfMode(rfc2833)
exten => s,n(DEFAULT),Noop

exten => s,1,GotoIf($[${DIALSTATUS} = CANCEL]?DONE:$[${PRIORITY}+1])
exten => s,n,Set(CDR(SIPCALLID2)=${DB(CHANID/${BRIDGEPEER:4})})
exten => s,n,Noop(${DB_DELETE(CHANID/${BRIDGEPEER:4})})
exten => s,n(DONE),Noop(${DIALSTATUS})

By: Leif Madsen (lmadsen) 2009-02-27 16:38:45.000-0600

Thank you for the bug report. However I am unable to reproduce this issue. We are now going to close this report - please feel free to reopen when you have more information at hand.