Module: sip-router Branch: master Commit: 42f2d990d022cb67b051ac563ee8cde916a0d14a URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=42f2d990...
Author: Dragos Dinu dragos.dinu@1and1.ro Committer: Anca Vamanu anca.vamanu@1and1.ro Date: Tue Mar 13 11:33:06 2012 +0200
modules_k/presence Used affected_rows SQL statement
In case affected_rows function is available in the DB driver, this function is used instead of an extra query in presentity table that only verified if the record existed.
Patch author Dragos Dinu dragos.dinu@1and1.ro
---
modules_k/presence/presentity.c | 436 ++++++++++++++++++++++---------------- 1 files changed, 252 insertions(+), 184 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=42f2...
Hi Anca,
I just tried this change on my system. With the change present and two presence/RLS clients signed in I get some error messages displayed when I log one of the clients out:
Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence_xml [notify_body.c:176]: while parsing the xml body message Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence_xml [notify_body.c:133]: in function get_final_notify_body Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence [notify.c:1396]: in function apply_auth_nbody Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence [notify.c:1583]: sending Notify not successful Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence [notify.c:1288]: Could not send notify for presence
I reversed out the change and the errors stopped happening, they started up again as soon as I put it back.
Thanks,
Peter
On Tue, 2012-03-13 at 10:40 +0100, Anca Vamanu wrote:
Module: sip-router Branch: master Commit: 42f2d990d022cb67b051ac563ee8cde916a0d14a URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=42f2d990...
Author: Dragos Dinu dragos.dinu@1and1.ro Committer: Anca Vamanu anca.vamanu@1and1.ro Date: Tue Mar 13 11:33:06 2012 +0200
modules_k/presence Used affected_rows SQL statement
In case affected_rows function is available in the DB driver, this function is used instead of an extra query in presentity table that only verified if the record existed.
Patch author Dragos Dinu dragos.dinu@1and1.ro
modules_k/presence/presentity.c | 436 ++++++++++++++++++++++---------------- 1 files changed, 252 insertions(+), 184 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=42f2...
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Hi Peter,
I found the source of the problem. For the case when publish with expires 0 is received, the order of operations has changed:
Now the delete in database is performed before sending the Notifies, and before it was the other way around. We had to perform the delete first, to find out if the record actually existed and if we need to send a Notify.
And actually the code relies on finding the record in database even for unPublish. The main reason is that it wants to build a pidf with status closed from the previous published state - to keep the same tuple id. I don't know if there are actually clients interpreting the tuple id (which should identify a certain device), but it was designed like this to be safe.
For this reason, we will have to give up on using affected_rows on delete and do the query each time. We will do the fix tomorrow.
Regards, Anca
On 03/13/2012 05:40 PM, Peter Dunkley wrote:
Hi Anca,
I just tried this change on my system. With the change present and two presence/RLS clients signed in I get some error messages displayed when I log one of the clients out:
Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence_xml [notify_body.c:176]: while parsing the xml body message Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence_xml [notify_body.c:133]: in function get_final_notify_body Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence [notify.c:1396]: in function apply_auth_nbody Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence [notify.c:1583]: sending Notify not successful Mar 13 15:36:09 pd-laptop-linux ./kamailio[1493]: ERROR: presence [notify.c:1288]: Could not send notify for presence
I reversed out the change and the errors stopped happening, they started up again as soon as I put it back.
Thanks,
Peter
On Tue, 2012-03-13 at 10:40 +0100, Anca Vamanu wrote:
Module: sip-router Branch: master Commit: 42f2d990d022cb67b051ac563ee8cde916a0d14a URL:http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=42f2d990...
Author: Dragos Dinu<dragos.dinu@1and1.ro mailto:dragos.dinu@1and1.ro> Committer: Anca Vamanu<anca.vamanu@1and1.ro mailto:anca.vamanu@1and1.ro> Date: Tue Mar 13 11:33:06 2012 +0200
modules_k/presence Used affected_rows SQL statement
In case affected_rows function is available in the DB driver, this function is used instead of an extra query in presentity table that only verified if the record existed.
Patch author Dragos Dinu<dragos.dinu@1and1.ro mailto:dragos.dinu@1and1.ro>
modules_k/presence/presentity.c | 436 ++++++++++++++++++++++---------------- 1 files changed, 252 insertions(+), 184 deletions(-)
Diff:http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=42f2...
sr-dev mailing list sr-dev@lists.sip-router.org mailto:sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
-- Peter Dunkley Technical Director Crocodile RCS Ltd
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
Hi Anca,
I am now seeing a different problem with unPUBLISH. When I unPUBLISH I get the errors:
Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: ERROR: db_postgres [km_dbase.c:493]: invalid query, execution aborted Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: ERROR: db_postgres [km_dbase.c:494]: driver error: PGRES_FATAL_ERROR, ERROR: column "domain" does not exist#012LINE 1: delete from active_watchers where domain='multifon.ru' AND u...#012 ^#012 Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: WARNING: db_postgres [km_dbase.c:565]: unexpected result returned
As a test I put a use_table call at the top of the presentity.c:update_presentity() function but that made no difference. I then explicitly added use_table() calls before each DB operation in presentity.c:update_presentity() and the problem went away. 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.
If that is what is happening than it makes the calls to affected_rows() used in this function a bit suspect as well. 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.
Regards,
Peter
On Thu, 2012-03-15 at 18:52 +0200, Anca Vamanu wrote:
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
Hi,
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).
Peter
On Fri, 2012-03-16 at 10:46 +0000, Peter Dunkley wrote:
Hi Anca,
I am now seeing a different problem with unPUBLISH. When I unPUBLISH I get the errors:
Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: ERROR: db_postgres [km_dbase.c:493]: invalid query, execution aborted Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: ERROR: db_postgres [km_dbase.c:494]: driver error: PGRES_FATAL_ERROR, ERROR: column "domain" does not exist#012LINE 1: delete from active_watchers where domain='multifon.ru' AND u...#012 ^#012 Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: WARNING: db_postgres [km_dbase.c:565]: unexpected result returned
As a test I put a use_table call at the top of the presentity.c:update_presentity() function but that made no difference. I then explicitly added use_table() calls before each DB operation in presentity.c:update_presentity() and the problem went away. 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.
If that is what is happening than it makes the calls to affected_rows() used in this function a bit suspect as well. 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.
Regards,
Peter
On Thu, 2012-03-15 at 18:52 +0200, Anca Vamanu wrote:
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
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Hi Peter,
You were right. I am sorry, I have not tested with DB_ONLY mode, only with this mode the problem showed up. I have committed the fix now.
Regards, Anca
On 03/16/2012 01:15 PM, Peter Dunkley wrote:
Hi,
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).
Peter
On Fri, 2012-03-16 at 10:46 +0000, Peter Dunkley wrote:
Hi Anca,
I am now seeing a different problem with unPUBLISH. When I unPUBLISH I get the errors:
Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: ERROR: db_postgres [km_dbase.c:493]: invalid query, execution aborted Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: ERROR: db_postgres [km_dbase.c:494]: driver error: PGRES_FATAL_ERROR, ERROR: column "domain" does not exist#012LINE 1: delete from active_watchers where domain='multifon.ru' AND u...#012 ^#012 Mar 16 10:20:44 pd-laptop-linux kamailio[20117]: WARNING: db_postgres [km_dbase.c:565]: unexpected result returned
As a test I put a use_table call at the top of the presentity.c:update_presentity() function but that made no difference. I then explicitly added use_table() calls before each DB operation in presentity.c:update_presentity() and the problem went away. 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.
If that is what is happening than it makes the calls to affected_rows() used in this function a bit suspect as well. 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.
Regards,
Peter
On Thu, 2012-03-15 at 18:52 +0200, Anca Vamanu wrote:
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
sr-dev mailing list sr-dev@lists.sip-router.org mailto:sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
-- Peter Dunkley Technical Director Crocodile RCS Ltd