[asterisk-bugs] [JIRA] (ASTERISK-23119) [patch] main/bridging.c sometimes fails to pthread_join the bridge thread

Matt Jordan (JIRA) noreply at issues.asterisk.org
Wed Jan 8 07:57:03 CST 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-23119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=213751#comment-213751 ] 

Matt Jordan commented on ASTERISK-23119:
----------------------------------------

While I agree with the problem, I'm not sure this patch is the right approach. Any time {{usleep}} gets introduced with another looping condition, it feels like we're trying to hack around the problem. As it is, this merely hopes that {{ast_bridge_destroy}} will get called within that time period, which while very likely, doesn't feel like the right approach.

The real problem here feels like {{bridge_thread}} setting {{bridge->thread}} to AST_PTHREAD_NULL. It probably shouldn't.
 * Calling {{pthread_join}} on a terminated thread is acceptable, as it will merely return automatically
 * Calling {{pthread_kill}} on a terminated thread should simply fail with ESRCH, which is acceptable

Not clearing the thread ID in that location should allow {{ast_bridge_destroy}} to join in an acceptable manner.



                
> [patch] main/bridging.c sometimes fails to pthread_join the bridge thread
> -------------------------------------------------------------------------
>
>                 Key: ASTERISK-23119
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23119
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Bridging
>    Affects Versions: 1.8.26.0, 11.8.0
>            Reporter: Corey Farrell
>         Attachments: bridging-empty_thread_wait.patch, leak.txt
>
>
> When Hangup is received from the last channel in a ConfBridge conference, bridge_array_remove() sets bridge->array_num to 0.  This can cause bridge_thread() to clear bridge->thread before ast_bridge_destroy() is run.  When that happens ast_bridge_destroy() doesn't call pthread_join().
> The only ConfBridge setting used was quiet=yes.  I used a SIP phone to place a call to ConfBridge, waited a few seconds then hung up from the phone.  This causes the issue almost every time with 1.8 and 11 in valgrind.  I have not tested 12 since it doesn't use bridge->array_num as a thread exit condition, and doesn't clear bridge->thread.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list