Hello,



On 4/8/13 7:13 PM, Ross Kusler wrote:

Hello,

 

                We noticed an issue with a bunch of stale entries in the mysql location table recently – all for the same user.  It turns out that if you install linphone 2.0.2 on an iOS device (other versions/platforms might also be affected) with the transport mode set to TCP and the ‘Push Notification’ feature enabled, the client generates very long contact (258+ character) headers.  The contact column in the location table is varchar(255), anything longer than this automatically gets truncated upon insert.  When the entry later expires and usrloc tries to remove it, it generates a delete query that matches on the entire contact value and not the truncated version.  This causes the delete query to fail and the usrloc record gets left behind in the location table.

 

The (truncated) contact header value from the database:

sip:22448462@98.248.37.244:52008;transport=tcp;app-id=org.linphone.phone.prod;pn-type=apple;pn-tok=AA31DC9642E76E7D7DA8A0E419B210E1A00E8DF43A7A77C8CD2955291E1BAC85;pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-call-snd=ring.caf;pn-msg-snd=msg.caf;line=932257155

 

The failed delete query:.

delete from location where username='XXXXXXXX' AND contact='sip:XXXXXXXX@11.22.333. 44:52000;transport=tcp;app-id=org.linphone.phone.prod;pn-type=apple;pn-tok=AA31DC9642E76E7D7DA8A0E419B210E1A00E8DF43A7A77C8CD2955291E1BAC85;pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-call-snd=ring.caf;pn-msg-snd=msg.caf;line=932257155f64767' AND callid='1962857815';

 

What do you all think the best solution here is?  My intuition is to simply increase the size of this column.  If this is the right approach then it probably also makes sense to update the .sql file for new installs.  Thoughts?

increasing the column is the solution, indeed. But I guess the db index on contact column will not work anymore, iirc, text indexes could be done on varchars (or strings up to 256 chars).

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, April 16-17, 2013, Berlin
 - http://conference.kamailio.com -