[Home]

Summary:ASTERISK-25776: lock-order-inversion (potential deadlock) when loading app_queue
Reporter:Badalian Vyacheslav (slavon)Labels:
Date Opened:2016-02-11 22:57:29.000-0600Date Closed:2016-02-12 13:05:09.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:
Versions:13.7.2 Frequency of
Occurrence
Related
Issues:
duplicatesASTERISK-25780 stasis: Potential deadlock
Environment:[root@vm-asterisk04t asterisk]# git branch -v * master a394865 Merge "Resources/res_phoneprov: fix memory leak and heap-use-after-free" Attachments:
Description:{code}
 == Manager registered action QueueMemberRingInUse
 == Manager registered action QueueRule
 == Manager registered action QueueReload
 == Manager registered action QueueReset
 == Registered custom function 'QUEUE_VARIABLES'
 == Registered custom function 'QUEUE_EXISTS'
 == Registered custom function 'QUEUE_MEMBER'
 == Registered custom function 'QUEUE_MEMBER_COUNT'
 == Registered custom function 'QUEUE_MEMBER_LIST'
 == Registered custom function 'QUEUE_GET_CHANNEL'
 == Registered custom function 'QUEUE_WAITING_COUNT'
 == Registered custom function 'QUEUE_MEMBER_PENALTY'
==================
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=4962)
 Cycle in lock order graph: M321986 (0x7d280016ec20) => M1076 (0x7d640004bf00) => M1075 (0x7d280007cf60) => M321986

 Mutex M1076 acquired here while holding mutex M321986 in main thread:
   #0 pthread_mutex_lock <null> (libtsan.so.0+0x000000037816)
   #1 __ast_pthread_mutex_lock /root/asterisk/main/lock.c:313 (asterisk+0x000000503d01)
   #2 __ao2_lock /root/asterisk/main/astobj2.c:200 (asterisk+0x0000002d78be)
   #3 stasis_topic_pool_get_topic /root/asterisk/main/stasis.c:1140 (asterisk+0x00000063a9b8)
   #4 ast_device_state_topic /root/asterisk/main/devicestate.c:710 (asterisk+0x0000004524e6)
   #5 device_state_aggregate_publish /root/asterisk/main/devicestate.c:805 (asterisk+0x000000452976)
   #6 caching_topic_exec /root/asterisk/main/stasis_cache.c:853 (asterisk+0x00000064b702)
   #7 subscription_invoke /root/asterisk/main/stasis.c:433 (asterisk+0x000000635f0d)
   #8 dispatch_message /root/asterisk/main/stasis.c:754 (asterisk+0x000000637e86)
   #9 publish_msg /root/asterisk/main/stasis.c:822 (asterisk+0x00000063838f)
   #10 stasis_publish /root/asterisk/main/stasis.c:830 (asterisk+0x00000063846e)
   #11 ast_publish_device_state_full /root/asterisk/main/devicestate.c:766 (asterisk+0x00000045279e)
   #12 ast_devstate_changed_literal /root/asterisk/main/devicestate.c:500 (asterisk+0x00000045139c)
   #13 ast_devstate_changed /root/asterisk/main/devicestate.c:532 (asterisk+0x0000004516f2)
   #14 init_queue /root/asterisk/apps/app_queue.c:2677 (app_queue.so+0x000000037e97)
   #15 reload_single_queue /root/asterisk/apps/app_queue.c:9011 (app_queue.so+0x0000000734e1)
   #16 reload_queues /root/asterisk/apps/app_queue.c:9142 (app_queue.so+0x00000007436f)
   #17 reload_handler /root/asterisk/apps/app_queue.c:9208 (app_queue.so+0x000000074822)
   #18 load_module /root/asterisk/apps/app_queue.c:10963 (app_queue.so+0x000000082025)
   #19 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000004ff12f)
   #20 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x000000500c7c)
   #21 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x000000501ade)
   #22 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x0000002d6e5d)
   #23 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x0000002d5cfd)

 Mutex M321986 previously acquired by the same thread here:
   #0 pthread_mutex_lock <null> (libtsan.so.0+0x000000037816)
   #1 __ast_pthread_mutex_lock /root/asterisk/main/lock.c:313 (asterisk+0x000000503d01)
   #2 __ao2_lock /root/asterisk/main/astobj2.c:200 (asterisk+0x0000002d78be)
   #3 publish_msg /root/asterisk/main/stasis.c:816 (asterisk+0x0000006382df)
   #4 stasis_publish /root/asterisk/main/stasis.c:830 (asterisk+0x00000063846e)
   #5 ast_publish_device_state_full /root/asterisk/main/devicestate.c:766 (asterisk+0x00000045279e)
   #6 ast_devstate_changed_literal /root/asterisk/main/devicestate.c:500 (asterisk+0x00000045139c)
   #7 ast_devstate_changed /root/asterisk/main/devicestate.c:532 (asterisk+0x0000004516f2)
   #8 init_queue /root/asterisk/apps/app_queue.c:2677 (app_queue.so+0x000000037e97)
   #9 reload_single_queue /root/asterisk/apps/app_queue.c:9011 (app_queue.so+0x0000000734e1)
   #10 reload_queues /root/asterisk/apps/app_queue.c:9142 (app_queue.so+0x00000007436f)
   #11 reload_handler /root/asterisk/apps/app_queue.c:9208 (app_queue.so+0x000000074822)
   #12 load_module /root/asterisk/apps/app_queue.c:10963 (app_queue.so+0x000000082025)
   #13 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000004ff12f)
   #14 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x000000500c7c)
   #15 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x000000501ade)
   #16 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x0000002d6e5d)
   #17 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x0000002d5cfd)

 Mutex M1075 acquired here while holding mutex M1076 in main thread:
   #0 pthread_mutex_lock <null> (libtsan.so.0+0x000000037816)
   #1 __ast_pthread_mutex_lock /root/asterisk/main/lock.c:313 (asterisk+0x000000503d01)
   #2 __ao2_lock /root/asterisk/main/astobj2.c:200 (asterisk+0x0000002d78be)
   #3 stasis_forward_all /root/asterisk/main/stasis.c:919 (asterisk+0x000000638f4b)
   #4 stasis_topic_pool_get_topic /root/asterisk/main/stasis.c:1157 (asterisk+0x00000063ac4f)
   #5 ast_device_state_topic /root/asterisk/main/devicestate.c:710 (asterisk+0x0000004524e6)
   #6 ast_publish_device_state_full /root/asterisk/main/devicestate.c:761 (asterisk+0x00000045276d)
   #7 ast_devstate_changed_literal /root/asterisk/main/devicestate.c:500 (asterisk+0x00000045139c)
   #8 ast_devstate_changed /root/asterisk/main/devicestate.c:532 (asterisk+0x0000004516f2)
   #9 init_queue /root/asterisk/apps/app_queue.c:2677 (app_queue.so+0x000000037e97)
   #10 reload_single_queue /root/asterisk/apps/app_queue.c:9011 (app_queue.so+0x0000000734e1)
   #11 reload_queues /root/asterisk/apps/app_queue.c:9142 (app_queue.so+0x00000007436f)
   #12 reload_handler /root/asterisk/apps/app_queue.c:9208 (app_queue.so+0x000000074822)
   #13 load_module /root/asterisk/apps/app_queue.c:10963 (app_queue.so+0x000000082025)
   #14 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000004ff12f)
   #15 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x000000500c7c)
   #16 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x000000501ade)
   #17 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x0000002d6e5d)
   #18 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x0000002d5cfd)

 Mutex M1076 previously acquired by the same thread here:
   #0 pthread_mutex_lock <null> (libtsan.so.0+0x000000037816)
   #1 __ast_pthread_mutex_lock /root/asterisk/main/lock.c:313 (asterisk+0x000000503d01)
   #2 __ao2_lock /root/asterisk/main/astobj2.c:200 (asterisk+0x0000002d78be)
   #3 stasis_topic_pool_get_topic /root/asterisk/main/stasis.c:1140 (asterisk+0x00000063a9b8)
   #4 ast_device_state_topic /root/asterisk/main/devicestate.c:710 (asterisk+0x0000004524e6)
   #5 ast_publish_device_state_full /root/asterisk/main/devicestate.c:761 (asterisk+0x00000045276d)
   #6 ast_devstate_changed_literal /root/asterisk/main/devicestate.c:500 (asterisk+0x00000045139c)
   #7 ast_devstate_changed /root/asterisk/main/devicestate.c:532 (asterisk+0x0000004516f2)
   #8 init_queue /root/asterisk/apps/app_queue.c:2677 (app_queue.so+0x000000037e97)
   #9 reload_single_queue /root/asterisk/apps/app_queue.c:9011 (app_queue.so+0x0000000734e1)
   #10 reload_queues /root/asterisk/apps/app_queue.c:9142 (app_queue.so+0x00000007436f)
   #11 reload_handler /root/asterisk/apps/app_queue.c:9208 (app_queue.so+0x000000074822)
   #12 load_module /root/asterisk/apps/app_queue.c:10963 (app_queue.so+0x000000082025)
   #13 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000004ff12f)
   #14 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x000000500c7c)
   #15 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x000000501ade)
   #16 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x0000002d6e5d)
   #17 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x0000002d5cfd)

 Mutex M321986 acquired here while holding mutex M1075 in main thread:
   #0 pthread_mutex_lock <null> (libtsan.so.0+0x000000037816)
   #1 __ast_pthread_mutex_lock /root/asterisk/main/lock.c:313 (asterisk+0x000000503d01)
   #2 __ao2_lock /root/asterisk/main/astobj2.c:200 (asterisk+0x0000002d78be)
   #3 topic_add_subscription /root/asterisk/main/stasis.c:660 (asterisk+0x00000063716c)
   #4 topic_add_subscription /root/asterisk/main/stasis.c:671 (asterisk+0x0000006375bf)
   #5 internal_stasis_subscribe /root/asterisk/main/stasis.c:503 (asterisk+0x000000636532)
   #6 stasis_subscribe /root/asterisk/main/stasis.c:517 (asterisk+0x000000636608)
   #7 load_module /root/asterisk/apps/app_queue.c:11028 (app_queue.so+0x0000000826a6)
   #8 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000004ff12f)
   #9 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x000000500c7c)
   #10 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x000000501ade)
   #11 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x0000002d6e5d)
   #12 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x0000002d5cfd)

 Mutex M1075 previously acquired by the same thread here:
   #0 pthread_mutex_lock <null> (libtsan.so.0+0x000000037816)
   #1 __ast_pthread_mutex_lock /root/asterisk/main/lock.c:313 (asterisk+0x000000503d01)
   #2 __ao2_lock /root/asterisk/main/astobj2.c:200 (asterisk+0x0000002d78be)
   #3 topic_add_subscription /root/asterisk/main/stasis.c:660 (asterisk+0x00000063716c)
   #4 internal_stasis_subscribe /root/asterisk/main/stasis.c:503 (asterisk+0x000000636532)
   #5 stasis_subscribe /root/asterisk/main/stasis.c:517 (asterisk+0x000000636608)
   #6 load_module /root/asterisk/apps/app_queue.c:11028 (app_queue.so+0x0000000826a6)
   #7 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000004ff12f)
   #8 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x000000500c7c)
   #9 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x000000501ade)
   #10 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x0000002d6e5d)
   #11 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x0000002d5cfd)

SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) ??:0 __interceptor_pthread_mutex_lock
{code}
Comments:By: Asterisk Team (asteriskteam) 2016-02-11 22:57:30.892-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Corey Farrell (coreyfarrell) 2016-02-12 10:07:30.012-0600

This looks like a duplicate of ASTERISK-25780?

By: Badalian Vyacheslav (slavon) 2016-02-12 10:46:33.481-0600

may be. ready to check out if you have a patch

By: Corey Farrell (coreyfarrell) 2016-02-12 13:04:59.928-0600

I believe this is a duplicate.  Let's use the other ticket since the issue appears to be in stasis, not app_queue.