<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10189">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">stasis_message.c: No need to keep a stasis type ref in a stasis msg object.<br><br>Stasis message types are global ao2 objects and we make stasis messages<br>hold references to them. Stasis messages could then be cached. Since<br>there are currently situations where cache objects are never deleted, the<br>reference count on the types can exceed 100000 and generate a FRACK<br>assertion message. The stasis message cache could conceivably also have<br>that many messages legitimately on large systems.<br><br>The only down side to not holding the message type ref in the stasis<br>message is it only makes a crash either at shutdown or when manually<br>unloading a busy module slightly more likely. However, this is more<br>exposing a pre-existing stasis shutdown ordering issue than a problem with<br>not holding a message type ref in stasis messages.<br><br>* Made stasis messages no longer hold a ref to the message type.<br><br>Change-Id: Ibaa28efa8d8ad3836f0c65957192424c7f561707<br>---<br>M main/stasis_message.c<br>1 file changed, 8 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/89/10189/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/stasis_message.c b/main/stasis_message.c</span><br><span>index 6274026..ba9953f 100644</span><br><span>--- a/main/stasis_message.c</span><br><span>+++ b/main/stasis_message.c</span><br><span>@@ -111,7 +111,6 @@</span><br><span> static void stasis_message_dtor(void *obj)</span><br><span> {</span><br><span> struct stasis_message *message = obj;</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(message->type);</span><br><span> ao2_cleanup(message->data);</span><br><span> }</span><br><span> </span><br><span>@@ -129,7 +128,14 @@</span><br><span> }</span><br><span> </span><br><span> message->timestamp = ast_tvnow();</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_ref(type, +1);</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * XXX Normal ao2 ref counting rules says we should increment the message</span><br><span style="color: hsl(120, 100%, 40%);">+ * type ref here and decrement it in stasis_message_dtor(). However, the</span><br><span style="color: hsl(120, 100%, 40%);">+ * stasis message could be cached and legitimately cause the type ref count</span><br><span style="color: hsl(120, 100%, 40%);">+ * to hit the excessive ref count assertion. Since the message type</span><br><span style="color: hsl(120, 100%, 40%);">+ * practically has to be a global object anyway, we can get away with not</span><br><span style="color: hsl(120, 100%, 40%);">+ * holding a ref in the stasis message.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span> message->type = type;</span><br><span> ao2_ref(data, +1);</span><br><span> message->data = data;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10189">change 10189</a>. To unsubscribe, or for help writing mail filters, 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/10189"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ibaa28efa8d8ad3836f0c65957192424c7f561707 </div>
<div style="display:none"> Gerrit-Change-Number: 10189 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>