[OpenSIPS-Devel] [ opensips-Bugs-2335003 ] ERROR:db_mysql:db_mysql_submit_query

SourceForge.net noreply at sourceforge.net
Wed Mar 18 20:00:50 CET 2009


Bugs item #2335003, was opened at 2008-11-23 22:54
Message generated for change (Comment added) made by ibc_sf
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2335003&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: trunk
Status: Open
Resolution: Accepted
Priority: 8
Private: No
Submitted By: Iñaki Baz (ibc_sf)
Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: ERROR:db_mysql:db_mysql_submit_query

Initial Comment:
This error occurs to me very often (sometimes during an INVITE, during a SUBSCRIBE...). If it occurs during an INVITE, then OpenSIPS returns 500:

-----------
Nov 23 16:42:07 [12195] ERROR:db_mysql:db_mysql_submit_query: driver error on 
query: Commands out of sync; you can't run this command now
Nov 23 16:42:07 [12195] ERROR:core:db_do_query: error while submitting query
Nov 23 16:42:07 [12195] ERROR:auth_db:get_ha1: failed to query database
-----------

I've two users registered (alice and bob), both registered in the same Twinkle sofphone.
- If alice calls (so OpenSIPS sends 407) the OpenSIPS returns 500 when alice re-sends the INVITE with credentials (auth_db issue clearly).
- If bob calls (OpenSIPS sends also 407) bob re-sends the INVITE with credentials and there is no problem.

After restarting OpenSIPS the issue dissapears (temporaly).

I've found similar problems, specially this thread:
  http://www.mail-archive.com/devel%40lists.openser.org/msg02761.html
in which Bogdan finally says:

---------
as the DB connections are TCP connections, if the connection is opened before the fork, it will inherited by all the forked child procs. This is a typical error if you mishandle a DB connection from mod_init().
---------

----------------------------------------------------------------------

>Comment By: Iñaki Baz (ibc_sf)
Date: 2009-03-18 20:00

Message:
thanks Bogdan, I'll try it right now and tell you.

----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-03-18 11:32

Message:
Ok, let's do it in the rough way - I added in the DB API (db/ dir) some
more logs in order to detect if there are some queries without freed
result. Please run an update from trunk version and run it with debug=6.
Once you get the error, get the logs and send the file to me (email).

Thanks and regards,
Bogdan

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2009-03-17 13:26

Message:
Well, the *same* bug occurs also in Kamailio trunk version. I don't know
how differents are presence modules in both projects.
I'm prety sure that the error is exclusively related to presence module (I
change the "Category" to "modules) since it just occurs when enabling
presence. Also the process suffering this issue is "Type=SIP receiver
udp:..."

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2009-03-17 11:34

Message:
Sorry, but the issue still exists, and not just in my server (running the
trunk version rev 5460):
I've installed OpenSIPS trunk in other Debian server and this error also
occurs.
In my server I again see this bug.

----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-03-11 10:17

Message:
Agreed!

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2009-03-11 00:02

Message:
I have rev 5385 running (not the last one). I've not seen the error in the
latest logs, but it's just a testing server with very low traffic
(basically one client connected). If you want, let's close this bug. If I
see the issue again I'll reopen it.

----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-03-10 13:46

Message:
Hi Inaki,

updating to the latest SVN version, do you still get this error?

Regards,
Bogdan

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2009-02-17 17:41

Message:
Sorry, it is:
- Proxy: running in 5060 and 5062.
- Presence Server: running in port 5065.

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2009-02-17 17:38

Message:
About this problem I would like to clarify that I have two OpenSIPS running
in the same host:

- Proxy: running in 5060 and 5062.
- Presence Server: running in port 5070.

There are separated directories for each one (for example
/var/run/opensips and /var/run/opensips_presence).

Both share the same MySQL database ("opensips") in the same host, but I
think there are no shared tables.

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2009-02-16 00:47

Message:
Hi, after some days I've rechecked the logs and the error still occurs. The
server has *very low* traffic (just me when open my softphone with 3-4
accounts configured). The version I'm running now is 5190 and I attach a
log.
Note however that in this log it seems that the error is related to
presence_dialoginfo module (the PUBLISH is generated by pua_dialoginfo).
The proccess involve in the bug is 10277.
File Added: ERROR_db_mysql-rev5190.txt

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2009-01-21 19:40

Message:
The last error:
  ERROR:db_mysql:db_mysql_submit_query: driver error on query: Commands
out of sync; you can't run this command now
occurred in Jan 15, but I don't know which revision I was using (anyway a
modern one).

I'm compiling it against the trunk revision right now and will check. I
have full logs (level = 4) and store the logs in a file separated from
syslog so if the error occurs I'd have enough information.

I would like to tell something better but this is the best I have.

----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-01-21 14:25

Message:
Hi Inaki,

is this issue still actual after the latest presence fixes?

Regards,
Bogdan

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2008-12-15 20:25

Message:
After some checks I've realized that this bug is related to presence
module.

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2008-12-11 10:32

Message:
Sorry, forget it. The problem also occurs with "children=1".
I'm getting crazy :(

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2008-12-10 17:47

Message:
The ERROR just occurs when "children>1". Some tested cases:

1) OK
children=1
dissable_tcp=no
listen=MY_IP:MY_PORT

2) ERROR:db_mysql:db_mysql_submit_query
children=2
dissable_tcp=no
listen=MY_IP:MY_PORT

3) OK
children=1
dissable_tcp=no
listen=MY_IP:MY_PORT
listen=MY_IP:MY_PORT_2
listen=MY_IP_2:MY_PORT
listen=MY_IP_2:MY_PORT_2

4) ERROR:db_mysql:db_mysql_submit_query
children=2
dissable_tcp=no
listen=MY_IP:MY_PORT
listen=MY_IP:MY_PORT_2
listen=MY_IP_2:MY_PORT
listen=MY_IP_2:MY_PORT_2


This is, the error occurs VERY VERY often when "children>1", no matter how
many listening binds there are.


Also, as you can see in the following log, the error is related to the
MySQL driver, regardless of the OpenSIPS module:

---------
opensips[23846]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Duplicate entry 'sip:bob at domain.net-bob-domain.net-presence'
for key 2
opensips[23846]: ERROR:core:db_do_insert: error while submitting query
opensips[23846]: ERROR:presence:update_presentity: inserting new
record in database
opensips[23846]: ERROR:presence:handle_publish: when updating presentity
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_query: error while submitting query
opensips[23847]: ERROR:presence:get_p_notify_body: failed to query
presentity table
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_query: error while submitting query
opensips[23847]: ERROR:auth_db:get_ha1: failed to query database
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_query: error while submitting query
opensips[23847]: ERROR:auth_db:get_ha1: failed to query database
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_delete: error while submitting query
opensips[23847]: ERROR:presence:delete_db_subs: sql delete failed
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_delete: error while submitting query
opensips[23847]: ERROR:presence:delete_db_subs: sql delete failed
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_delete: error while submitting query
opensips[23847]: ERROR:presence:delete_db_subs: sql delete failed
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_delete: error while submitting query
opensips[23847]: ERROR:presence:delete_db_subs: sql delete failed
opensips[23847]: ERROR:presence:update_subscription: deleting
subscription record from database
opensips[23847]: ERROR:presence:handle_subscribe: in update_subscription
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_delete: error while submitting query
opensips[23847]: ERROR:presence:delete_db_subs: sql delete failed
opensips[23847]: ERROR:presence:update_subscription: deleting
subscription record from database
opensips[23847]: ERROR:presence:handle_subscribe: in update_subscription
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_delete: error while submitting query
opensips[23847]: ERROR:presence:delete_db_subs: sql delete failed
opensips[23847]: ERROR:presence:update_subscription: deleting
subscription record from database
opensips[23847]: ERROR:presence:handle_subscribe: in update_subscription
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_delete: error while submitting query
opensips[23847]: ERROR:presence:delete_db_subs: sql delete failed
opensips[23847]: ERROR:presence:update_subscription: deleting
subscription record from database
opensips[23847]: ERROR:presence:handle_subscribe: in update_subscription
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_delete: error while submitting query
opensips[23847]: ERROR:presence:delete_db_subs: sql delete failed
opensips[23847]: ERROR:presence:update_subscription: deleting
subscription record from database
opensips[23847]: ERROR:presence:handle_subscribe: in update_subscription
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_delete: error while submitting query
opensips[23847]: ERROR:presence:delete_db_subs: sql delete failed
opensips[23847]: ERROR:presence:update_subscription: deleting
subscription record from database
opensips[23847]: ERROR:presence:handle_subscribe: in update_subscription
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_query: error while submitting query
opensips[23847]: ERROR:auth_db:get_ha1: failed to query database
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_query: error while submitting query
opensips[23847]: ERROR:auth_db:get_ha1: failed to query database
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_query: error while submitting query
opensips[23847]: ERROR:auth_db:get_ha1: failed to query database
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_query: error while submitting query
opensips[23847]: ERROR:auth_db:get_ha1: failed to query database
opensips[23847]: ERROR:db_mysql:db_mysql_submit_query: driver error on
query: Commands out of sync; you can't run this command now
opensips[23847]: ERROR:core:db_do_query: error while submitting query
opensips[23847]: ERROR:auth_db:get_ha1: failed to query database
----------

----------------------------------------------------------------------

Comment By: Iñaki Baz (ibc_sf)
Date: 2008-11-24 14:23

Message:
I use Debian Etch (64 bits) with OpenSIPS trunk version:

ii  libmysqlclient15-dev              5.0.32-7etch6
ii  libmysqlclient15off               5.0.32-7etch6
ii  mysql-client-5.0                  5.0.32-7etch6
ii  mysql-common                      5.0.32-7etch6
ii  mysql-server-5.0                  5.0.32-7etch6
ii  opensips-mysql-module             1.4.0-1

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2335003&group_id=232389



More information about the Devel mailing list