i tried to use db_cluster with presence server and got crash:
core was generated by `/usr/sbin/pres-serv -f /etc/pres-serv/pres-serv.cfg -P /var/run/pres-serv/pres-'. Program terminated with signal 11, Segmentation fault. #0 0x00007f39f3c13b13 in db_do_query_internal (_h=0x7f39f53b5708, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0, val2str=0x7f39f4c31cbc <db_mysql_val2str>, submit_query=0x7f39f4c2b615 <db_mysql_submit_query>, store_result=0x7f39f4c2bb9c <db_mysql_store_result>, _l=0) at db_query.c:83 83 db_query.c: No such file or directory.
(gdb) where #0 0x00007f39f3c13b13 in db_do_query_internal (_h=0x7f39f53b5708, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0, val2str=0x7f39f4c31cbc <db_mysql_val2str>, submit_query=0x7f39f4c2b615 <db_mysql_submit_query>, store_result=0x7f39f4c2bb9c <db_mysql_store_result>, _l=0) at db_query.c:83 #1 0x00007f39f3c14303 in db_do_query (_h=0x7f39f53b5708, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0, val2str=0x7f39f4c31cbc <db_mysql_val2str>, submit_query=0x7f39f4c2b615 <db_mysql_submit_query>, store_result=0x7f39f4c2bb9c <db_mysql_store_result>) at db_query.c:156 #2 0x00007f39f4c2c727 in db_mysql_query (_h=0x7f39f53b5708, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0) at km_dbase.c:261 #3 0x00007f39f1abec8e in db_cluster_query (_h=0x7f39f53b4788, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0) at dbcl_api.c:300 #4 0x00007f39f3c1651f in db_fetch_query_internal (dbf=0x7f39f03cec20, frows=500, _h=0x7f39f53b4788, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x7fff811b8c88, _query=0x7f39f1abe854 <db_cluster_query>) at db_query.c:427 #5 0x00007f39f3c169cc in db_fetch_query (dbf=0x7f39f03cec20, frows=500, _h=0x7f39f53b4788, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x7fff811b8c88) at db_query.c:466 #6 0x00007f39f01aab1f in clean_puadb (update_period=30, min_expires=0) at pua_db.c:171 #7 0x00007f39f01a60a2 in hashT_clean (ticks=95327236, param=0x0) at pua.c:685 #8 0x0000000000525839 in compat_old_handler (ti=1525235788, tl=0x7f39ecc03a90, data=0x7f39ecc03a90) at timer.c:1017 #9 0x0000000000525da1 in slow_timer_main () at timer.c:1151 #10 0x00000000004656f0 in main_loop () at main.c:1692 #11 0x00000000004685f8 in main (argc=16, argv=0x7fff811b9088) at main.c:2563
i don't know why gdb complains about missing db_query.c.
this is with latest master.
-- juha
Hi,
From a quick look at the code this could happen if the table name or
length was a bad pointer.
If that is the case then it means these have not been properly set somewhere further up the call stack (so in db_mysql, db_cluster, or pua itself). I suspect it's OK in pua as there would be problems when I use db_postgres.
Regards,
Peter
On Thu, 2012-09-27 at 17:33 +0300, Juha Heinanen wrote:
i tried to use db_cluster with presence server and got crash:
core was generated by `/usr/sbin/pres-serv -f /etc/pres-serv/pres-serv.cfg -P /var/run/pres-serv/pres-'. Program terminated with signal 11, Segmentation fault. #0 0x00007f39f3c13b13 in db_do_query_internal (_h=0x7f39f53b5708, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0, val2str=0x7f39f4c31cbc <db_mysql_val2str>, submit_query=0x7f39f4c2b615 <db_mysql_submit_query>, store_result=0x7f39f4c2bb9c <db_mysql_store_result>, _l=0) at db_query.c:83 83 db_query.c: No such file or directory.
(gdb) where #0 0x00007f39f3c13b13 in db_do_query_internal (_h=0x7f39f53b5708, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0, val2str=0x7f39f4c31cbc <db_mysql_val2str>, submit_query=0x7f39f4c2b615 <db_mysql_submit_query>, store_result=0x7f39f4c2bb9c <db_mysql_store_result>, _l=0) at db_query.c:83 #1 0x00007f39f3c14303 in db_do_query (_h=0x7f39f53b5708, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0, val2str=0x7f39f4c31cbc <db_mysql_val2str>, submit_query=0x7f39f4c2b615 <db_mysql_submit_query>, store_result=0x7f39f4c2bb9c <db_mysql_store_result>) at db_query.c:156 #2 0x00007f39f4c2c727 in db_mysql_query (_h=0x7f39f53b5708, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0) at km_dbase.c:261 #3 0x00007f39f1abec8e in db_cluster_query (_h=0x7f39f53b4788, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x0) at dbcl_api.c:300 #4 0x00007f39f3c1651f in db_fetch_query_internal (dbf=0x7f39f03cec20, frows=500, _h=0x7f39f53b4788, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x7fff811b8c88, _query=0x7f39f1abe854 <db_cluster_query>) at db_query.c:427 #5 0x00007f39f3c169cc in db_fetch_query (dbf=0x7f39f03cec20, frows=500, _h=0x7f39f53b4788, _k=0x7fff811b8c90, _op=0x7fff811b8c50, _v=0x7fff811b8c60, _c=0x0, _n=1, _nc=0, _o=0x0, _r=0x7fff811b8c88) at db_query.c:466 #6 0x00007f39f01aab1f in clean_puadb (update_period=30, min_expires=0) at pua_db.c:171 #7 0x00007f39f01a60a2 in hashT_clean (ticks=95327236, param=0x0) at pua.c:685 #8 0x0000000000525839 in compat_old_handler (ti=1525235788, tl=0x7f39ecc03a90, data=0x7f39ecc03a90) at timer.c:1017 #9 0x0000000000525da1 in slow_timer_main () at timer.c:1151 #10 0x00000000004656f0 in main_loop () at main.c:1692 #11 0x00000000004685f8 in main (argc=16, argv=0x7fff811b9088) at main.c:2563
i don't know why gdb complains about missing db_query.c.
this is with latest master.
-- juha
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Peter Dunkley writes:
From a quick look at the code this could happen if the table name or
length was a bad pointer.
peter,
i didn't change table names when i turned on cluster. i just changed this:
modparam("pua", "db_url", "cluster://pres_serv_cluster")
crash happens on timer before presence server has got any requests.
without db_cluster, presence works fine. have you tried presence with db_cluster?
-- juha
Hello,
a quick look over the pua_db.c file shows that dbf.use_table(...) is not used before doing the queries. That is required for db_cluster. Perhaps someone that is able to test the module can add the fix quickly -- I cannot do it for the next few days.
Cheers, Daniel
On 9/27/12 4:58 PM, Juha Heinanen wrote:
Peter Dunkley writes:
From a quick look at the code this could happen if the table name or
length was a bad pointer.
peter,
i didn't change table names when i turned on cluster. i just changed this:
modparam("pua", "db_url", "cluster://pres_serv_cluster")
crash happens on timer before presence server has got any requests.
without db_cluster, presence works fine. have you tried presence with db_cluster?
-- juha
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel-Constantin Mierla writes:
a quick look over the pua_db.c file shows that dbf.use_table(...) is not used before doing the queries. That is required for db_cluster. Perhaps someone that is able to test the module can add the fix quickly -- I cannot do it for the next few days.
if peter gives me the patch, i can test it.
-- juha
I might have time to do this over the next few days, but can't promise anything.
Peter
On Thu, 2012-09-27 at 18:20 +0300, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
a quick look over the pua_db.c file shows that dbf.use_table(...) is not used before doing the queries. That is required for db_cluster. Perhaps someone that is able to test the module can add the fix quickly -- I cannot do it for the next few days.
if peter gives me the patch, i can test it.
-- juha
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha,
you can find the *.use_table() somewhere in mod_init or child_init and then use the same code before any db operation done over the same dbf structure.
Cheers, Daniel
On 9/27/12 5:22 PM, Peter Dunkley wrote:
I might have time to do this over the next few days, but can't promise anything.
Peter
On Thu, 2012-09-27 at 18:20 +0300, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
a quick look over the pua_db.c file shows that dbf.use_table(...) is not used before doing the queries. That is required for db_cluster. Perhaps someone that is able to test the module can add the fix quickly -- I cannot do it for the next few days.
if peter gives me the patch, i can test it.
-- juha
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,
This kind-of makes sense because the pua module only deals with one table, when using a normal DB module, having set the table name once you never need to do it again.
If db_cluster() is different perhaps it'd be good to make it explicitly check for this and log an error in this case?
The pua DB is accessed in several different files so if this change is made all files will need to be checked and updated.
Regards,
Peter
On Thu, 2012-09-27 at 17:14 +0200, Daniel-Constantin Mierla wrote:
Hello,
a quick look over the pua_db.c file shows that dbf.use_table(...) is not used before doing the queries. That is required for db_cluster. Perhaps someone that is able to test the module can add the fix quickly -- I cannot do it for the next few days.
Cheers, Daniel
On 9/27/12 4:58 PM, Juha Heinanen wrote:
Peter Dunkley writes:
From a quick look at the code this could happen if the table name or
length was a bad pointer.
peter,
i didn't change table names when i turned on cluster. i just changed this:
modparam("pua", "db_url", "cluster://pres_serv_cluster")
crash happens on timer before presence server has got any requests.
without db_cluster, presence works fine. have you tried presence with db_cluster?
-- juha
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Hello,
On 9/27/12 5:21 PM, Peter Dunkley wrote:
Hi,
This kind-of makes sense because the pua module only deals with one table, when using a normal DB module, having set the table name once you never need to do it again.
when dealing with a direct connection to db, this is ok, because the module has a db-link structure where it keeps the table name. But the db_cluster is intermediate layer to several link structures which can be used from many modules.
If db_cluster() is different perhaps it'd be good to make it explicitly check for this and log an error in this case?
The pua DB is accessed in several different files so if this change is made all files will need to be checked and updated.
Yes, use table should be enforced before any query in any module, being the safest way. There were some troubles in the past with modules using many tables as well.
Setting the table is just and assignment with a direct connection db module.
Cheers, Daniel
Regards,
Peter
On Thu, 2012-09-27 at 17:14 +0200, Daniel-Constantin Mierla wrote:
Hello,
a quick look over the pua_db.c file shows that dbf.use_table(...) is not used before doing the queries. That is required for db_cluster. Perhaps someone that is able to test the module can add the fix quickly -- I cannot do it for the next few days.
Cheers, Daniel
On 9/27/12 4:58 PM, Juha Heinanen wrote:
Peter Dunkley writes:
From a quick look at the code this could happen if the table name or
length was a bad pointer.
peter,
i didn't change table names when i turned on cluster. i just changed this:
modparam("pua", "db_url", "cluster://pres_serv_cluster")
crash happens on timer before presence server has got any requests.
without db_cluster, presence works fine. have you tried presence with db_cluster?
-- juha
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
i applied the patch below to pua module and the crash disappeared. can i commit it to master? i wonder if there are other places where use_table should be added in some other modules.
-- juha
diff -c /usr/src/orig/sip-router/modules_k/pua/pua.c ./pua.c *** /usr/src/orig/sip-router/modules_k/pua/pua.c 2012-09-16 17:24:34.515266527 +0300 --- ./pua.c 2012-09-27 18:39:24.938581317 +0300 *************** *** 63,69 **** int min_expires= 0; int default_expires=3600; static str db_url = str_init(DEFAULT_DB_URL); ! static str db_table= str_init("pua"); int update_period= 100; str outbound_proxy = {0, 0}; int check_remote_contact = 1; --- 63,69 ---- int min_expires= 0; int default_expires=3600; static str db_url = str_init(DEFAULT_DB_URL); ! str db_table= str_init("pua"); int update_period= 100; str outbound_proxy = {0, 0}; int check_remote_contact = 1; diff -c /usr/src/orig/sip-router/modules_k/pua/pua_db.c ./pua_db.c *** /usr/src/orig/sip-router/modules_k/pua/pua_db.c 2012-09-16 17:34:22.367646853 +0300 --- ./pua_db.c 2012-09-27 18:50:47.275474397 +0300 *************** *** 168,173 **** --- 168,178 ---- q_vals[0].val.int_val = now+update_period; q_ops[0] = OP_LT;
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) { + LM_ERR("error in use_table pua\n"); + return(-1); + } + if(db_fetch_query(&pua_dbf, pua_fetch_rows, pua_db, q_cols, q_ops, q_vals, NULL, 1, 0, 0, &res) < 0) { *************** *** 279,284 **** --- 284,294 ---- return(-1); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(-1); + }
if(pua_dbf.query(pua_db, q_cols, 0, q_vals, res_cols,n_query_cols,n_res_cols,0,&res) < 0) *************** *** 367,372 **** --- 377,388 ---- return(-1); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(-1); + } + if(pua_dbf.query(pua_db, q_cols, 0, q_vals, res_cols,n_query_cols,n_res_cols,0,&res) < 0) { *************** *** 614,620 **** query_vals[n_query_cols].val.str_val.len = 0; n_query_cols++;
!
if (pua_dbf.replace != NULL) { --- 630,640 ---- query_vals[n_query_cols].val.str_val.len = 0; n_query_cols++;
! if (pua_dbf.use_table(pua_db, &db_table) < 0) ! { ! LM_ERR("error in use_table pua\n"); ! return(-1); ! }
if (pua_dbf.replace != NULL) { *************** *** 843,848 **** --- 863,874 ---- return(NULL); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(NULL); + } + if(query_fn(pua_db, q_cols, 0, q_vals, NULL,n_query_cols,0,0,&res) < 0) { *************** *** 919,924 **** --- 945,956 ---- return(-1); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(-1); + } + if (pua_dbf.delete(pua_db, q_cols, 0, q_vals, n_query_cols) < 0) { LM_ERR("deleting record\n"); *************** *** 985,990 **** --- 1017,1028 ---- return(-1); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(-1); + } + if (pua_dbf.update(pua_db, q_cols, 0, q_vals, u_cols, u_vals, n_query_cols, n_update_cols) < 0) { *************** *** 1192,1197 **** --- 1230,1241 ---- return(NULL); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(NULL); + } + if(query_fn(pua_db, q_cols, 0, q_vals, NULL,n_query_cols,0,0,&res) < 0) { *************** *** 1278,1283 **** --- 1322,1333 ---- return(-1); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(-1); + } + if (pua_dbf.delete(pua_db, q_cols, 0, q_vals, n_query_cols) < 0) { LM_ERR("deleting record\n"); *************** *** 1350,1355 **** --- 1400,1411 ---- return(-1); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(-1); + } + if (pua_dbf.update(pua_db, q_cols, 0, q_vals, u_cols, u_vals, n_query_cols, n_update_cols) < 0) { *************** *** 1409,1414 **** --- 1465,1476 ---- return(-1); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(-1); + } + if(pua_dbf.update(pua_db, q_cols, 0, q_vals, db_cols,db_vals,n_query_cols,n_update_cols) < 0) { *************** *** 1467,1472 **** --- 1529,1540 ---- return(-1); }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(-1); + } + if(pua_dbf.update(pua_db, q_cols, 0, q_vals, db_cols,db_vals,n_query_cols,n_update_cols) < 0)
*************** *** 1505,1510 **** --- 1573,1584 ---- return list; }
+ if (pua_dbf.use_table(pua_db, &db_table) < 0) + { + LM_ERR("error in use_table pua\n"); + return(list); + } + if(db_fetch_query(&pua_dbf, pua_fetch_rows, pua_db, q_cols, 0, q_vals, res_cols, n_query_cols, n_res_cols, 0, &res) < 0) { diff -c /usr/src/orig/sip-router/modules_k/pua/pua.h ./pua.h *** /usr/src/orig/sip-router/modules_k/pua/pua.h 2012-09-02 15:14:34.426055998 +0300 --- ./pua.h 2012-09-27 18:48:22.298428856 +0300 *************** *** 59,63 **** --- 59,64 ---- extern db1_con_t *pua_db; extern int pua_fetch_rows;
+ extern str db_table;
#endif
I am not that familiar with 'diff -c' format, but I guess it is ok. Ultimately can be reverted.
Many modules were updated to use use_table() before db ops along the time, but there might still be some that have to be updated. Perhaps is good to check the sources when using a module with db cluster.
Not sure everyone knows, but if you work on a source tree taken from git, then you can do:
git diff >/path/to/save/the/patch
an you get the diff in unified format (git friendly).
If wanted, you can reset all the changes that were not committed with: git reset --hard HEAD
Cheers, Daniel
On 9/27/12 5:58 PM, Juha Heinanen wrote:
i applied the patch below to pua module and the crash disappeared. can i commit it to master? i wonder if there are other places where use_table should be added in some other modules.
-- juha
diff -c /usr/src/orig/sip-router/modules_k/pua/pua.c ./pua.c *** /usr/src/orig/sip-router/modules_k/pua/pua.c 2012-09-16 17:24:34.515266527 +0300 --- ./pua.c 2012-09-27 18:39:24.938581317 +0300
*** 63,69 **** int min_expires= 0; int default_expires=3600; static str db_url = str_init(DEFAULT_DB_URL); ! static str db_table= str_init("pua"); int update_period= 100; str outbound_proxy = {0, 0}; int check_remote_contact = 1; --- 63,69 ---- int min_expires= 0; int default_expires=3600; static str db_url = str_init(DEFAULT_DB_URL); ! str db_table= str_init("pua"); int update_period= 100; str outbound_proxy = {0, 0}; int check_remote_contact = 1; diff -c /usr/src/orig/sip-router/modules_k/pua/pua_db.c ./pua_db.c *** /usr/src/orig/sip-router/modules_k/pua/pua_db.c 2012-09-16 17:34:22.367646853 +0300 --- ./pua_db.c 2012-09-27 18:50:47.275474397 +0300
*** 168,173 **** --- 168,178 ---- q_vals[0].val.int_val = now+update_period; q_ops[0] = OP_LT;
- if (pua_dbf.use_table(pua_db, &db_table) < 0) {
LM_ERR("error in use_table pua\n");
return(-1);
- }
- if(db_fetch_query(&pua_dbf, pua_fetch_rows, pua_db, q_cols, q_ops, q_vals, NULL, 1, 0, 0, &res) < 0) {
*** 279,284 **** --- 284,294 ---- return(-1); }
if (pua_dbf.use_table(pua_db, &db_table) < 0)
{
LM_ERR("error in use_table pua\n");
return(-1);
}
if(pua_dbf.query(pua_db, q_cols, 0, q_vals, res_cols,n_query_cols,n_res_cols,0,&res) < 0)
*** 367,372 **** --- 377,388 ---- return(-1); }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(-1);
- }
- if(pua_dbf.query(pua_db, q_cols, 0, q_vals, res_cols,n_query_cols,n_res_cols,0,&res) < 0) {
*** 614,620 **** query_vals[n_query_cols].val.str_val.len = 0; n_query_cols++;
!
if (pua_dbf.replace != NULL) {
--- 630,640 ---- query_vals[n_query_cols].val.str_val.len = 0; n_query_cols++;
! if (pua_dbf.use_table(pua_db, &db_table) < 0) ! { ! LM_ERR("error in use_table pua\n"); ! return(-1); ! }
if (pua_dbf.replace != NULL) {
*** 843,848 **** --- 863,874 ---- return(NULL); }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(NULL);
- }
- if(query_fn(pua_db, q_cols, 0, q_vals, NULL,n_query_cols,0,0,&res) < 0) {
*** 919,924 **** --- 945,956 ---- return(-1); }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(-1);
- }
- if (pua_dbf.delete(pua_db, q_cols, 0, q_vals, n_query_cols) < 0) { LM_ERR("deleting record\n");
*** 985,990 **** --- 1017,1028 ---- return(-1); }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(-1);
- }
- if (pua_dbf.update(pua_db, q_cols, 0, q_vals, u_cols, u_vals, n_query_cols, n_update_cols) < 0) {
*** 1192,1197 **** --- 1230,1241 ---- return(NULL); }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(NULL);
- }
- if(query_fn(pua_db, q_cols, 0, q_vals, NULL,n_query_cols,0,0,&res) < 0) {
*** 1278,1283 **** --- 1322,1333 ---- return(-1); }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(-1);
- }
- if (pua_dbf.delete(pua_db, q_cols, 0, q_vals, n_query_cols) < 0) { LM_ERR("deleting record\n");
*** 1350,1355 **** --- 1400,1411 ---- return(-1); }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(-1);
- }
- if (pua_dbf.update(pua_db, q_cols, 0, q_vals, u_cols, u_vals, n_query_cols, n_update_cols) < 0) {
*** 1409,1414 **** --- 1465,1476 ---- return(-1); }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(-1);
- }
- if(pua_dbf.update(pua_db, q_cols, 0, q_vals, db_cols,db_vals,n_query_cols,n_update_cols) < 0) {
*** 1467,1472 **** --- 1529,1540 ---- return(-1); }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(-1);
- }
- if(pua_dbf.update(pua_db, q_cols, 0, q_vals, db_cols,db_vals,n_query_cols,n_update_cols) < 0)
*** 1505,1510 **** --- 1573,1584 ---- return list; }
- if (pua_dbf.use_table(pua_db, &db_table) < 0)
- {
LM_ERR("error in use_table pua\n");
return(list);
- }
- if(db_fetch_query(&pua_dbf, pua_fetch_rows, pua_db, q_cols, 0, q_vals, res_cols, n_query_cols, n_res_cols, 0, &res) < 0) {
diff -c /usr/src/orig/sip-router/modules_k/pua/pua.h ./pua.h *** /usr/src/orig/sip-router/modules_k/pua/pua.h 2012-09-02 15:14:34.426055998 +0300 --- ./pua.h 2012-09-27 18:48:22.298428856 +0300
*** 59,63 **** --- 59,64 ---- extern db1_con_t *pua_db; extern int pua_fetch_rows;
extern str db_table;
#endif
Daniel-Constantin Mierla writes:
I am not that familiar with 'diff -c' format, but I guess it is ok. Ultimately can be reverted.
i made the commit, but so far only to master in order to give time for proper testing and for peter to check it up.
Many modules were updated to use use_table() before db ops along the time, but there might still be some that have to be updated. Perhaps is good to check the sources when using a module with db cluster.
if i see similar crashed with other modules, i can patch them too, but so far this has only been with pua.
If wanted, you can reset all the changes that were not committed with: git reset --hard HEAD
thanks for the tip. i was afraid to mess up my master branch.
-- juha