asterisk/cel
Kevin Harwell bb30b22419 cel_pgsql: deadlock on unload and core_event_dispatcher
A deadlock can happen between a thread unloading or reloading the cel_pgsql
module and the core_event_dispatcher taskprocessor thread. Description of
what is happening:

Thread 1 (for example, a netconsole thread):

    a "module reload cel_pgsql" is launched
    the thread enter the "my_unload_module" function (cel_pgsql.c)
    the thread acquire the write lock on psql_columns
    the thread enter the "ast_event_unsubscribe" function (event.c)
    the thread try to acquire the write lock on ast_event_subs[sub->type]

Thread 2 (core_event_dispatcher taskprocessor thread):

    the taskprocessor pop a CEL event
    the thread enter the "handle_event" function (event.c)
    the thread acquire the read lock on ast_event_subs[sub->type]
    the thread callback the "pgsql_log" function (cel_pgsql.c), since it's a subscriber of CEL events
    the thread try to acquire a read lock on psql_columns

(closes issue ASTERISK-22854)
Reported by: Etienne Lessard
Patches:
     cel_pgsql_fix_deadlock_event.patch uploaded by hexanol (license 6394)
........

Merged revisions 404603 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 404604 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 404605 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404606 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-31 21:39:45 +00:00
..
Makefile Title update 2012-10-14 21:56:13 +00:00
cel_custom.c Be a little more verbose when loading cel_custom.conf. 2013-09-03 14:29:52 +00:00
cel_manager.c Refactor CEL to avoid using the event system core 2013-08-17 14:46:44 +00:00
cel_odbc.c Refactor CEL to avoid using the event system core 2013-08-17 14:46:44 +00:00
cel_pgsql.c cel_pgsql: deadlock on unload and core_event_dispatcher 2013-12-31 21:39:45 +00:00
cel_radius.c Refactor CEL to avoid using the event system core 2013-08-17 14:46:44 +00:00
cel_sqlite3_custom.c Refactor CEL to avoid using the event system core 2013-08-17 14:46:44 +00:00
cel_tds.c Refactor CEL to avoid using the event system core 2013-08-17 14:46:44 +00:00