<p>Richard Mudgett <strong>posted comments</strong> on this change.</p><p><a href="https://gerrit.asterisk.org/6710">View Change</a></p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p>(5 comments)</p><ul style="list-style: none; padding-left: 20px;"><li><p><a href="https://gerrit.asterisk.org/#/c/6710/1/main/astobj2_container.c">File main/astobj2_container.c:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6710/1/main/astobj2_container.c@458">Patch Set #1, Line 458:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">      if (!(flags & OBJ_NOLOCK)) {<br>              ao2_lock(c);<br>  }<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">This should be done like in internal_ao2_traverse().  The weak object container doesn't have any restrictions on what kind of lock it has if any.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6710/1/main/astobj2_container.c@465">Patch Set #1, Line 465:</a> <code style="font-family:monospace,monospace">          /* Never lock proxy while instances is already locked. */</code></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Comment:<br>/* <br> * We cannot get the real object while the proxy container<br> * is locked.  We would deadlock.<br> */</pre><p style="white-space: pre-wrap; word-wrap: break-word;"><br>Seems like this should be fixed so that the weak proxy subscription callbacks are not called while the proxy is locked.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6710/1/main/astobj2_container.c@470">Patch Set #1, Line 470:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">          if (obj) {<br>                    /* We have an existing object and it's not being destroyed. */<br>                    ao2_ref(proxy, -1);<br><br>                 return obj;<br>           }<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">This is always returning with the container locked.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6710/1/main/astobj2_container.c@478">Patch Set #1, Line 478:</a> <code style="font-family:monospace,monospace">            ao2_unlink_flags(c, proxy, OBJ_NOLOCK);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">I think we would want to use __adjust_lock() to set the container lock so it doesn't have to be readjusted by the unlink and subsequent find.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6710/1/main/astobj2_container.c@481">Patch Set #1, Line 481:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">               if (tries >= 3) {<br>                  /* Unlikely but not impossible.  Bail to avoid infinate loop. */<br>                      *ret = -1;<br>                    break;<br>                }<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">How could you have an infinite loop?  Every dying proxy is explicitly removed from the container above and thus prevents finding it again.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Also a container could have more than three duplicate objects in it.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/6710">change 6710</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6710"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I9da822049747275f5961b5c0a7f14e87157d65d8 </div>
<div style="display:none"> Gerrit-Change-Number: 6710 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 10 Oct 2017 18:47:16 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>