[Home]

Summary:ASTERISK-25787: chan_sip: Race condition when executing "sip show peers"
Reporter:Badalian Vyacheslav (slavon)Labels:
Date Opened:2016-02-12 12:49:16.000-0600Date Closed:2016-10-30 13:41:34
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:Frequency of
Occurrence
Related
Issues:
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}
==================
WARNING: ThreadSanitizer: data race (pid=22097)
 Read of size 4 at 0x7d64001f7a24 by main thread (mutexes: write M83453):
   #0 <null> <null> (chan_sip.so+0x000000092f6e) = /root/asterisk/channels/chan_sip.c peer_status
   #1 <null> <null> (chan_sip.so+0x000000094b18) = /root/asterisk/channels/chan_sip.c:19654 _sip_show_peers_one
   #2 <null> <null> (chan_sip.so+0x000000094681) = /root/asterisk/channels/chan_sip.c:19596 _sip_show_peers
   #3 <null> <null> (chan_sip.so+0x000000093f8e) = /root/asterisk/channels/chan_sip.c:19481 sip_show_peers
   #4 ast_cli_command_full /root/asterisk/main/cli.c:2717 (asterisk+0x00000014dd3b)
   #5 consolehandler /root/asterisk/main/asterisk.c:2230 (asterisk+0x00000007df36)
   #6 asterisk_daemon /root/asterisk/main/asterisk.c:4743 (asterisk+0x000000088d6c)
   #7 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x000000087707)

 Previous write of size 4 at 0x7d64001f7a24 by thread T64 (mutexes: write M152606):
   #0 <null> <null> (chan_sip.so+0x0000000d7004) = /root/asterisk/channels/chan_sip.c:29488 sip_poke_peer
   #1 <null> <null> (chan_sip.so+0x0000000753ca) = /root/asterisk/channels/chan_sip.c:16046 sip_poke_peer_s
   #2 ast_sched_runq /root/asterisk/main/sched.c:748 (asterisk+0x0000002b3f91)
   #3 <null> <null> (chan_sip.so+0x0000000d3a62) = /root/asterisk/channels/chan_sip.c:28985 do_monitor
   #4 dummy_start /root/asterisk/main/utils.c:1232 (asterisk+0x00000031efb1)
   #5 <null> <null> (libtsan.so.0+0x000000023659)

 Location is heap block of size 1160 at 0x7d64001f7700 allocated by main thread:
   #0 calloc <null> (libtsan.so.0+0x000000025bed)
   #1 _ast_calloc /root/asterisk/include/asterisk/utils.h:573 (asterisk+0x000000088e88)
   #2 __ao2_alloc /root/asterisk/main/astobj2.c:597 (asterisk+0x00000008a086)
   #3 <null> <null> (chan_sip.so+0x0000000e3ff0) = /root/asterisk/channels/chan_sip.c:30523 build_peer
   #4 <null> <null> (chan_sip.so+0x0000000f9c07) = /root/asterisk/channels/chan_sip.c:32439 reload_config
   #5 <null> <null> (chan_sip.so+0x000000100ee4) = /root/asterisk/channels/chan_sip.c:34587 load_module
   #6 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000001f0d33)
   #7 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x0000001f1d15)
   #8 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x0000001f26da)
   #9 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x00000008880d)
   #10 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x000000087707)

 Mutex M83453 (0x7d64001f7700) created at:
   #0 pthread_mutex_init <null> (libtsan.so.0+0x000000028645)
   #1 __ast_pthread_mutex_init /root/asterisk/main/lock.c:149 (asterisk+0x0000001f3d46)
   #2 __ao2_alloc /root/asterisk/main/astobj2.c:603 (asterisk+0x00000008a0c6)
   #3 <null> <null> (chan_sip.so+0x0000000e3ff0) = /root/asterisk/channels/chan_sip.c:30523 build_peer
   #4 <null> <null> (chan_sip.so+0x0000000f9c07) = /root/asterisk/channels/chan_sip.c:32439 reload_config
   #5 <null> <null> (chan_sip.so+0x000000100ee4) = /root/asterisk/channels/chan_sip.c:34587 load_module  
   #6 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000001f0d33)
   #7 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x0000001f1d15)
   #8 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x0000001f26da)
   #9 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x00000008880d)
   #10 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x000000087707)

 Mutex M152606 (0x7fccfbfe0480) created at:
   #0 pthread_mutex_lock <null> (libtsan.so.0+0x000000037816)
   #1 __ast_pthread_mutex_lock /root/asterisk/main/lock.c:313 (asterisk+0x0000001f3de2)
   #2 <null> <null> (chan_sip.so+0x0000000d3bae) = /root/asterisk/channels/chan_sip.c:29002 restart_monitor
   #3 <null> <null> (chan_sip.so+0x00000010167a) = /root/asterisk/channels/chan_sip.c:34695 load_module
   #4 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000001f0d33)
   #5 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x0000001f1d15)
   #6 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x0000001f26da)
   #7 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x00000008880d)
   #8 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x000000087707)

 Thread T64 (tid=22642, running) created by main thread at:
   #0 pthread_create <null> (libtsan.so.0+0x000000027b07)
   #1 ast_pthread_create_stack /root/asterisk/main/utils.c:1285 (asterisk+0x00000031f25f)
   #2 <null> <null> (chan_sip.so+0x0000000d3cc1) =  /root/asterisk/channels/chan_sip.c:29013 restart_monitor
   #3 <null> <null> (chan_sip.so+0x00000010167a) = /root/asterisk/channels/chan_sip.c:34695 load_module
   #4 start_resource /root/asterisk/main/loader.c:1015 (asterisk+0x0000001f0d33)
   #5 load_resource_list /root/asterisk/main/loader.c:1213 (asterisk+0x0000001f1d15)
   #6 load_modules /root/asterisk/main/loader.c:1366 (asterisk+0x0000001f26da)
   #7 asterisk_daemon /root/asterisk/main/asterisk.c:4659 (asterisk+0x00000008880d)
   #8 main /root/asterisk/main/asterisk.c:4230 (asterisk+0x000000087707)

SUMMARY: ThreadSanitizer: data race ??:0 ??
==================

{code}
Comments:By: Asterisk Team (asteriskteam) 2016-02-12 12:49:17.228-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].