fixed in rev 8101<br><br><div class="gmail_quote">On Mon, Apr 14, 2008 at 8:51 AM, Jonathan Palley &lt;<a href="mailto:jpalley@gmail.com">jpalley@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi -<br>
 &nbsp; There is a small bug with registration expiration and nathack.<br>
There is an easy fix but the behavior is unexpected and I believe<br>
there is a chance it may point to a larger problem.<br>
<br>
So, I bring it up here. &nbsp;The bug:<br>
<br>
sofia_reg.c has the function sofia_reg_check_expire which is called<br>
once a minute to clean out expired registrations from the database.<br>
<br>
On line 263: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;switch_snprintf(sql, sizeof(sql), &quot;delete from<br>
sip_registrations where expires &gt; 0 and expires &lt;= %ld&quot;, (long) now);<br>
<br>
It deletes expired registrations.<br>
<br>
Later in the function we search for NATHACK user agents to send them<br>
an OPTIONS for the NAT keep alive.<br>
<br>
Line 282: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch_snprintf(sql, sizeof(sql), &quot;select * from<br>
sip_registrations where status like &#39;%%NATHACK%%&#39;&quot;);<br>
<br>
<br>
Here&#39;s the BUG: Line 282 selects records in the database that are<br>
supposed to be deleted in 263. &nbsp;This means you send NAT keep alive to<br>
agents that have already expired. &nbsp;The registrations are then cleared<br>
out of the db once this function completes. &nbsp;Clearly there is some<br>
sort of lock around the db that prevents the delete from occurring<br>
when the sql function is actually called.<br>
<br>
Now, we can solve the immediate bug by changing the SQL statement in<br>
Line 282 to not select expired registrations...but is the sqlite<br>
supposed to lock like this?<br>
<br>
<br>
Thanks -<br>
JP<br>
<br>
<br>
_______________________________________________<br>
Freeswitch-dev mailing list<br>
<a href="mailto:Freeswitch-dev@lists.freeswitch.org">Freeswitch-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
<br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400