<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/3377/">https://reviewboard.asterisk.org/r/3377/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 28th, 2014, 12:27 p.m. CDT, <b>Corey Farrell</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Do we want to produce a warning if someone tries writing to refs from logger.conf (an error if they do so with REF_DEBUG enabled)?  I know this is unlikely, I'm just trying to think of everything since this is being applied to existing branches.


With refcounter.py I found two backtraces:
KeyboardInterrupt (Ctrl-C)
IOError: [Errno 32] Broken pipe (exiting less before refcounter.py finished output)

It'd be awesome if these would just silently exit.</pre>
 </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Having logger.c emit an error if someone creates a log file with the name of 'refs': this isn't done for the memory allocation log file either. In general, if you're using REF_DEBUG, MALLOC_DEBUG, or other compile time options to create additional debug output, you should have some consideration for knowing what you're doing.

I added a try/except around the bulk of the processing that handles KeybaordInterrupt/SystemExit.</pre>
<br />







<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 28th, 2014, 12:27 p.m. CDT, <b>Corey Farrell</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://reviewboard.asterisk.org/r/3377/diff/4/?file=56827#file56827line232" style="color: black; font-weight: bold; text-decoration: underline;">/branches/1.8/channels/chan_sip.c</a>
    <span style="font-weight: normal;">

     (Diff revision 4)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">ASTERISK_FILE_VERSION(__FILE__, "$Revision$")</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">232</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">/* #define  REF_DEBUG 1 */</pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Another comment like this was added to channels/sip/security_events.c in 11+.  Please make sure it's removed when you commit.</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">That's fine.</pre>
<br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 28th, 2014, 12:27 p.m. CDT, <b>Corey Farrell</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://reviewboard.asterisk.org/r/3377/diff/4/?file=56828#file56828line130" style="color: black; font-weight: bold; text-decoration: underline;">/branches/1.8/contrib/scripts/refcounter.py</a>
    <span style="font-weight: normal;">

     (Diff revision 4)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">130</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="n">parser</span><span class="o">.</span><span class="n">add_option</span><span class="p">(</span><span class="s">"-n"</span><span class="p">,</span> <span class="s">"--suppress-normal"</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s">"store_false"</span><span class="p">,</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">131</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                      <span class="n">dest</span><span class="o">=</span><span class="s">"normal"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">132</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                      <span class="n">help</span><span class="o">=</span><span class="s">"If specified, don't output objects with a "</span> \</pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">133</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                           <span class="s">"complete lifetime"</span><span class="p">)</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I don't much care for output of normal objects by default.  This produces very large output even for just starting and stopping asterisk (9.4MB in my test run of 1.8), and objects that didn't leak or skew are not normally useful.  If I were troubleshooting an issue and felt the need to see normal objects, I would just want the original /var/log/asterisk/refs to see the order of all refs without grouping by object.

I'm not sure the other --suppress options are useful either.  I think it would be fine if we always print all skew and leak objects (both are errors), and give an option to enable showing of normal objects.  Less is better when it comes time to instruct a bug reporter on how to provide us the required information.</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I don't really like having some options that invert output, and others that enable it. I'd rather either show all and disable what you don't want to show; or show none and enable what you want to show.

I prefer the suppression route myself. For now, I'll leave this as is.</pre>
<br />




<p>- Matt</p>


<br />
<p>On April 9th, 2014, 4:08 p.m. CDT, Matt Jordan wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers, Corey Farrell and wdoekes.</div>
<div>By Matt Jordan.</div>


<p style="color: grey;"><i>Updated April 9, 2014, 4:08 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<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;">Note: while an improvement to Asterisk, this patch only affects Asterisk when compiled in -dev-mode. Since it has benefit only for developers looking to fix bugs, I'm proposing it for Asterisk 1.8+. The removal of refcounter should be done in trunk only.

Asterisk uses reference counted objects. A lot. As their use has spread, the bugs related to reference counting errors has grown as well. Central to resolving reference counting issues is the usage of REF_DEBUG; unfortunately, REF_DEBUG has had several problems:
(1) It could not be enabled through menuselect
(2) When not enabled globally, updates to objects were often lost, resulting in insufficient data to resolve problems
(3) The format of the ref debug log file was not suitable for parsing

This patch changes REF_DEBUG in the following ways:
(1) It makes REF_DEBUG a meneselect item when Asterisk is compiled with --enable-dev-mode
(2) The ref debug log file is now created in the AST_LOG_DIR directory. Every run will now blow away the previous run (as large ref files sometimes caused issues). We now also no longer open/close the file on each write, instead relying on fflush to make sure data gets written to the file (in case the ao2 call being performed is about to cause a crash)
(3) It goes with a comma delineated format for the ref debug file. This makes parsing much easier.
(4) It throws out the refcounter utility and goes with a python script instead.</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;">Things spit out ref logs and the script parses them. Example below:

==== Object 0x21ed9b8 history ====
features.c[5427]:create_parkinglot 1  - [**constructor**]
features.c[5707]:build_parkinglot +1  - [1]
features.c[5392]:parkinglot_unref -1  - [2]
features.c[6358]:build_dialplan_useage_map +1  - [1]
features.c[6358]:build_dialplan_useage_map -1  - [2]
features.c[4985]:find_parkinglot +1  - [1]
features.c[5392]:parkinglot_unref -1  - [2]
features.c[6358]:build_dialplan_useage_map +1  - [1]
features.c[6358]:build_dialplan_useage_map -1  - [2]
features.c[4955]:do_parking_thread +1  - [1]
features.c[4957]:do_parking_thread -1  - [2]
astobj2.c[955]:cd_cb_debug -1 deref object via container destroy - [1]
astobj2.c[955]:cd_cb_debug -1 deref object via container destroy - [**call destructor**]

</pre>
  </td>
 </tr>
</table>


<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/utils/utils.xml <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/utils/refcounter.c <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/utils/Makefile <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/main/utils.c <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/main/logger.c <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/main/astobj2.c <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/main/asterisk.c <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/include/asterisk/utils.h <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/include/asterisk/astobj2.h <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/contrib/scripts/refcounter.py <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/1.8/channels/chan_sip.c <span style="color: grey">(410891)</span></li>

 <li>/branches/1.8/build_tools/cflags.xml <span style="color: grey">(410891)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/3377/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>