Summary:ASTERISK-20347: Asterisk 1.8.16rc1 deadlock in cdr_mysql
Reporter:David Brillert (aragon)Labels:
Date Opened:2012-08-30 20:27:00Date Closed:2016-02-12 15:14:42.000-0600
Versions: Frequency of
Environment:Centos 5.8 x64, 8core, 8GB RAMAttachments:( 0) asterisk-11.17.0-cdr-mysql-reload-avoid-deadlock.patch
( 1) coreshowlocks.txt
( 2) thread-apply-all-bt.txt
Description:As per Matt Jordan I am opening a bug report for a deadlock found in Asterisk 1.8.16rc and cdr_mysql.
All I have for now is a gdb backtrace unoptimized but should soon be able to provide a non-optimized bt and core show locks output.  Opening ticket without that for now...
Comments:By: David Brillert (aragon) 2012-08-31 07:45:58.237-0500

This is an 8 core 64 bit machine with 8 GB RAM.
And even so the system was so bogged down by the non-optimized build I installed last night that no phones could even register.  The system was completely unusable.  The best we were able to do here is to collect some core show locks data before the system had a chance to lock.  I've attached those logs to this ticket.

I hope there is enough data already provided to get a handle on this issue and get it fixed because I don't know what else to do...  

By: Matt Jordan (mjordan) 2012-09-06 08:28:40.183-0500

I've ack'd the issue.  Please keep in mind that cdr_mysql is a community supported module, as it is in extended support.  Response times may reflect that.

By: David Brillert (aragon) 2012-09-14 09:38:32.485-0500

Matt - Is cdr_odbc an officially supported module?

By: Matt Jordan (mjordan) 2012-09-14 10:40:48.487-0500

No, {{cdr_odbc}} is extended support as well.  The core supported CDR modules in Asterisk 1.8 are:

* {{cdr_adaptive_odbc}}
* {{cdr_custom}}
* {{cdr_manager}}
* {{cdr_syslog}}

You can get a listing of the support status for each module in the {{menuselect}} tool.

By: David Brillert (aragon) 2012-09-17 12:39:43.157-0500

Thanks Matt, I'm converting everything to cdr_adaptive_odbc so I must close this ticket if deadlock is in cdr_mysql.

By: Alex VillacĂ­s Lasso (a_villacis) 2015-04-12 11:22:04.252-0500

I can confirm (through the output of core show locks) that this issue remains in asterisk-11.17.0. This patch against 11.17.10 is an attempt to fix the root cause of the deadlock: cdr_mysql is calling ast_cdr_unregister() with its internal lock held, while a hangup requests the cdr lock and then the cdr_mysql internal lock.