fixed in rev 8101

On Mon, Apr 14, 2008 at 8:51 AM, Jonathan Palley <jpalley@gmail.com> wrote:
Hi -
  There is a small bug with registration expiration and nathack.
There is an easy fix but the behavior is unexpected and I believe
there is a chance it may point to a larger problem.

So, I bring it up here.  The bug:

sofia_reg.c has the function sofia_reg_check_expire which is called
once a minute to clean out expired registrations from the database.

On line 263:                    switch_snprintf(sql, sizeof(sql), "delete from
sip_registrations where expires > 0 and expires <= %ld", (long) now);

It deletes expired registrations.

Later in the function we search for NATHACK user agents to send them
an OPTIONS for the NAT keep alive.

Line 282:               switch_snprintf(sql, sizeof(sql), "select * from
sip_registrations where status like '%%NATHACK%%'");


Here's the BUG: Line 282 selects records in the database that are
supposed to be deleted in 263.  This means you send NAT keep alive to
agents that have already expired.  The registrations are then cleared
out of the db once this function completes.  Clearly there is some
sort of lock around the db that prevents the delete from occurring
when the sql function is actually called.

Now, we can solve the immediate bug by changing the SQL statement in
Line 282 to not select expired registrations...but is the sqlite
supposed to lock like this?


Thanks -
JP


_______________________________________________
Freeswitch-dev mailing list
Freeswitch-dev@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400