On Sunday 28 August 2011, MÉSZÁROS Mihály wrote:
I attached the log file. If you need detailed log/higher log level, then please let me know.
usrloc seems to be using the same connection from multiple processes:
pid: 18389 and 18391, connection: 0xb7387d5c
Aug 28 12:40:10 hal /usr/sbin/kamailio[18389]: INFO: db_mysql [km_dbase.c:83]: submit_query: con: 0xb7387d5c table: location query: select contact,expires,q,callid,cseq,flags,cflags,user_agent,received,path,socket,methods,last_modified from location where username='mutf-hd' order by q Aug 28 12:40:10 hal /usr/sbin/kamailio[18391]: INFO: db_mysql [km_dbase.c:83]: submit_query: con: 0xb7387d5c table: location query: select contact,expires,q,callid,cseq,flags,cflags,user_agent,received,path,socket,methods,last_modified from location where username='ppke-vjk' order by q Aug 28 12:40:10 hal /usr/sbin/kamailio[18389]: INFO: db_mysql [km_dbase.c:177]: store_result: con: 0xb7387d5c table: location Aug 28 12:40:10 hal /usr/sbin/kamailio[18389]: INFO: db_mysql [km_dbase.c:83]: submit_query: con: 0xb7387d5c table: location query: update location set expires='2011-08-28 12:45:10',q=-1.00 ,cseq=2,flags=0,cflags=0,user_agent='Polycom HDX 8000 HD (Release - 3.0.2.1-17007)',received=NULL,path=NULL,socket='tcp:195.111.192.7:5060',methods=24575,last_modified='2011-08-28 12:40:10' where username='mutf-hd' AND contact='sip:mutf-hd@193.225.216.28:5060;transport=tcp' AND callid='3533311123-1752' Aug 28 12:40:10 hal /usr/sbin/kamailio[18391]: INFO: db_mysql [km_dbase.c:177]: store_result: con: 0xb7387d5c table: location Aug 28 12:40:10 hal /usr/sbin/kamailio[18391]: INFO: db_mysql [km_dbase.c:83]: submit_query: con: 0xb7387d5c table: location query: insert into location Aug 28 12:40:10 hal /usr/sbin/kamailio[18389]: INFO: db_mysql [km_dbase.c:83]: submit_query: con: 0xb7387d5c table: location query: select contact,expires,q,callid,cseq,flags,cflags,user_agent,received,path,socket,methods,last_modified from location where username='de-tek-hpc' order by q Aug 28 12:40:10 hal /usr/sbin/kamailio[18389]: ERROR: db_mysql [km_dbase.c:131]: driver error on query: Commands out of sync; you can't run this command now
It probably needs a fix like below because mod_init has also created a db connection which is inherited by at least one child and ul_dbh is not 0 anymore. That process needs to be excluded from opening a database connection, all other childs need to open their own DB connection. I just don't know what rank mod_init is run as and thus don't know which process to exclude. Maybe some other dev can jump in.
diff --git a/modules_k/usrloc/ul_mod.c b/modules_k/usrloc/ul_mod.c index b3a9499..ca50b01 100644 --- a/modules_k/usrloc/ul_mod.c +++ b/modules_k/usrloc/ul_mod.c @@ -378,7 +378,7 @@ static int child_init(int _rank) break; }
- if (!ul_dbh) + if (rank != PROC_MAIN) ul_dbh = ul_dbf.init(&db_url); /* Get a new database connection */ if (!ul_dbh) { LM_ERR("child(%d): failed to connect to database\n", _rank);