<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.2.3">
</HEAD>
<BODY>
Hi,<BR>
<BR>
Another, more likely, possibility is that somewhere after the first use_table and query on presentity but before the delete there is a function called that queries active_watchers (to find out what dialogs to send NOTIFYs on).<BR>
<BR>
Peter<BR>
<BR>
On Fri, 2012-03-16 at 10:46 +0000, Peter Dunkley wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
    Hi Anca,<BR>
    <BR>
    I am now seeing a different problem with unPUBLISH.&nbsp; When I unPUBLISH I get the errors:<BR>
    <BLOCKQUOTE>
        Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: ERROR: db_postgres [km_dbase.c:493]: invalid query, execution aborted<BR>
        Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: ERROR: db_postgres [km_dbase.c:494]: driver error: PGRES_FATAL_ERROR, ERROR:&nbsp; column &quot;domain&quot; does not exist#012LINE 1: delete from active_watchers where domain='multifon.ru' AND u...#012&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^#012<BR>
        Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: WARNING: db_postgres [km_dbase.c:565]: unexpected result returned<BR>
    </BLOCKQUOTE>
    <BR>
    As a test I put a use_table call at the top of the presentity.c:update_presentity() function but that made no difference.&nbsp; I then explicitly added use_table() calls before each DB operation in presentity.c:update_presentity() and the problem went away.&nbsp; I don't have time to look into it further but I suspect this means there is some issue related how Kamailio pools the DB connections meaning that (because this is a long function with lots of queries) some other query (in this case on active_watchers) happens on the connection in between the queries in this function.<BR>
    <BR>
    If that is what is happening than it makes the calls to affected_rows() used in this function a bit suspect as well.&nbsp; affected_rows() returns the rows affected by the last DB operation, and it looks like it is entirely possible that this last operation may not always be one that is in the same function.<BR>
    <BR>
    Regards,<BR>
    <BR>
    Peter<BR>
    <BR>
    On Thu, 2012-03-15 at 18:52 +0200, Anca Vamanu wrote: 
    <BLOCKQUOTE TYPE=CITE>
<PRE>
Hi Peter,

I have fixed the issue with the unPublish.

I have did another commit in the code : changed the sql query at delete 
in active_watchers to use the callid,to_tag,from_tag unique key.

I also realised that for DB_ONLY mode an index on presentity_uri column 
is need, so I updated the database schema.

Let us know the results of the performance tests.

Regards,
Anca


</PRE>
    </BLOCKQUOTE>
    <BR>
    <TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
_______________________________________________
sr-dev mailing list
<A HREF="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</A>
<A HREF="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</A>

</PRE>
</TD>
</TR>
</TABLE>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>