[Home]

Summary:ASTERISK-25763: TSAN: Data race in json free
Reporter:Badalian Vyacheslav (slavon)Labels:
Date Opened:2016-02-09 18:31:27.000-0600Date Closed:2016-02-09 19:23:40.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:
Versions:13.7.2 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:As i understand you destroy locked mutex

{code}
==================
WARNING: ThreadSanitizer: data race (pid=22242)
 Write of size 1 at 0x7d24002e7078 by thread T21:
   #0 pthread_mutex_destroy <null> (libtsan.so.0+0x00000002878d)
   #1 __ast_pthread_mutex_destroy /root/asterisk-13.7.0/main/lock.c:205 (asterisk+0x0000004de247)
   #2 json_mem_free /root/asterisk-13.7.0/main/json.c:68 (asterisk+0x0000004d0846)
   #3 ast_json_unref /root/asterisk-13.7.0/main/json.c:235 (asterisk+0x0000004d0ec2)
   #4 json_payload_destructor /root/asterisk-13.7.0/main/json.c:801 (asterisk+0x0000004d30f5)
   #5 internal_ao2_ref /root/asterisk-13.7.0/main/astobj2.c:445 (asterisk+0x0000002cb653)
   #6 __ao2_ref /root/asterisk-13.7.0/main/astobj2.c:516 (asterisk+0x0000002cba40)
   #7 __ao2_cleanup /root/asterisk-13.7.0/main/astobj2.c:529 (asterisk+0x0000002cbadc)
   #8 stasis_message_dtor /root/asterisk-13.7.0/main/stasis_message.c:107 (asterisk+0x00000062a4e5)
   #9 internal_ao2_ref /root/asterisk-13.7.0/main/astobj2.c:445 (asterisk+0x0000002cb653)
   #10 __ao2_ref /root/asterisk-13.7.0/main/astobj2.c:516 (asterisk+0x0000002cba40)
   #11 __ao2_cleanup /root/asterisk-13.7.0/main/astobj2.c:529 (asterisk+0x0000002cbadc)
   #12 dispatch_exec_async /root/asterisk-13.7.0/main/stasis.c:696 (asterisk+0x000000604362)
   #13 ast_taskprocessor_execute /root/asterisk-13.7.0/main/taskprocessor.c:782 (asterisk+0x000000648e9b)
   #14 default_tps_processing_function /root/asterisk-13.7.0/main/taskprocessor.c:183 (asterisk+0x00000064549d)
   #15 dummy_start /root/asterisk-13.7.0/main/utils.c:1237 (asterisk+0x00000067e255)
   #16 <null> <null> (libtsan.so.0+0x000000023659)

 Previous atomic read of size 1 at 0x7d24002e7078 by main thread:
   #0 pthread_mutex_lock <null> (libtsan.so.0+0x000000037816)
   #1 __ast_pthread_mutex_lock /root/asterisk-13.7.0/main/lock.c:313 (asterisk+0x0000004de2a0)
   #2 json_mem_lock /root/asterisk-13.7.0/main/json.c:112 (asterisk+0x0000004d0922)
   #3 ast_json_unref /root/asterisk-13.7.0/main/json.c:222 (asterisk+0x0000004d0e6a)
   #4 really_quit /root/asterisk-13.7.0/main/asterisk.c:2096 (asterisk+0x0000002bb3b0)
   #5 quit_handler /root/asterisk-13.7.0/main/asterisk.c:1929 (asterisk+0x0000002baac5)
   #6 asterisk_daemon /root/asterisk-13.7.0/main/asterisk.c:4738 (asterisk+0x0000002ca84a)
   #7 main /root/asterisk-13.7.0/main/asterisk.c:4282 (asterisk+0x0000002c93ad)

 Location is heap block of size 144 at 0x7d24002e7070 allocated by main thread:
   #0 malloc <null> (libtsan.so.0+0x000000025a33)
   #1 _ast_malloc /root/asterisk-13.7.0/include/asterisk/utils.h:547 (asterisk+0x0000004cf79e)
   #2 ast_json_malloc /root/asterisk-13.7.0/main/json.c:140 (asterisk+0x0000004d09d6)
   #3 json_object <null> (libjansson.so.4+0x00000000720a)
   #4 ast_json_pack /root/asterisk-13.7.0/main/json.c:693 (asterisk+0x0000004d2a41)
   #5 really_quit /root/asterisk-13.7.0/main/asterisk.c:2092 (asterisk+0x0000002bb388)
   #6 quit_handler /root/asterisk-13.7.0/main/asterisk.c:1929 (asterisk+0x0000002baac5)
   #7 asterisk_daemon /root/asterisk-13.7.0/main/asterisk.c:4738 (asterisk+0x0000002ca84a)
   #8 main /root/asterisk-13.7.0/main/asterisk.c:4282 (asterisk+0x0000002c93ad)

 Thread T21 (tid=22744, running) created by main thread at:
   #0 pthread_create <null> (libtsan.so.0+0x000000027b07)
   #1 ast_pthread_create_stack /root/asterisk-13.7.0/main/utils.c:1290 (asterisk+0x00000067e69e)
   #2 default_listener_start /root/asterisk-13.7.0/main/taskprocessor.c:200 (asterisk+0x0000006455f8)
   #3 __allocate_taskprocessor /root/asterisk-13.7.0/main/taskprocessor.c:611 (asterisk+0x000000648086)
   #4 ast_taskprocessor_get /root/asterisk-13.7.0/main/taskprocessor.c:657 (asterisk+0x000000648273)
   #5 internal_stasis_subscribe /root/asterisk-13.7.0/main/stasis.c:479 (asterisk+0x000000602b22)
   #6 stasis_subscribe /root/asterisk-13.7.0/main/stasis.c:510 (asterisk+0x000000602e1b)
   #7 stasis_message_router_create_internal /root/asterisk-13.7.0/main/stasis_message_router.c:230 (asterisk+0x00000062c40b)
   #8 stasis_message_router_create /root/asterisk-13.7.0/main/stasis_message_router.c:243 (asterisk+0x00000062c505)
   #9 manager_subscriptions_init /root/asterisk-13.7.0/main/manager.c:8512 (asterisk+0x00000051c976)
   #10 subscribe_all /root/asterisk-13.7.0/main/manager.c:8531 (asterisk+0x00000051ca44)
   #11 __init_manager /root/asterisk-13.7.0/main/manager.c:8788 (asterisk+0x00000051e4fb)
   #12 init_manager /root/asterisk-13.7.0/main/manager.c:9084 (asterisk+0x000000520a3c)
   #13 asterisk_daemon /root/asterisk-13.7.0/main/asterisk.c:4656 (asterisk+0x0000002ca324)
   #14 main /root/asterisk-13.7.0/main/asterisk.c:4282 (asterisk+0x0000002c93ad)

SUMMARY: ThreadSanitizer: data race ??:0 pthread_mutex_destroy
==================
{code}
Comments:By: Asterisk Team (asteriskteam) 2016-02-09 18:31:28.762-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: Badalian Vyacheslav (slavon) 2016-02-09 19:23:40.306-0600

ASTERISK-25765