<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2012/">https://reviewboard.asterisk.org/r/2012/</a>
</td>
</tr>
</table>
<br />
<p>Ship it!</p>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Alright, looks good to me.</pre>
<br />
<p>- jrose</p>
<br />
<p>On July 5th, 2012, 5:11 p.m., Mark Michelson wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Mark Michelson.</div>
<p style="color: grey;"><i>Updated July 5, 2012, 5:11 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">It appears that under normal circumstances, bridging threads are never joined using pthread_join(). The reporter supplied a patch that makes the bridge thread detached rather than joinable. I don't feel this is sufficient because the smart_bridge_operation() joins the thread partway through its method. This implies that it intends for the bridge thread to be completely finished and cleaned up prior to continuing.
In this patch, I have fixed the leak by adding a pthread_join() call to the code in ast_bridge_destroy(). I also have modified bridge_check_dissolve() not to set the stop flag. If bridge_check_dissolve() sets the stop flag for the bridge, then the bridge_thread will set bridge->thread to AST_PTHREADT_NULL. This will make it impossible for ast_bridge_destroy() to be able to tell if there is a thread that needs to be joined.
</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Ran a SIPp scenario that had calls constantly joining and leaving a conference bridge until a total of 2000 participants had joined and left.
Unfortunately, it's difficult to see if the added pthread_join() calls are doing anything because on my system, neither gdb nor /proc will display zombie threads. So for me anyway, gdb and /proc appear the same before and after applying the patch. More importantly, this patch does not appear to cause any crashes or other problems.</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-19834">ASTERISK-19834</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/branches/1.8/main/bridging.c <span style="color: grey">(369625)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2012/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>