[Freeswitch-dev] Registration Expiration Problem with NATHACK
Anthony Minessale
anthony.minessale at gmail.com
Mon Apr 14 11:34:57 EDT 2008
fixed in rev 8101
On Mon, Apr 14, 2008 at 8:51 AM, Jonathan Palley <jpalley at 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 at 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 at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:213-799-1400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20080414/ed83f668/attachment.html
More information about the Freeswitch-dev
mailing list