Hi Mani,
if this will make the testing easier, here is the patch you can apply
against 1.5.
Regards,
Bogdan
mani sivaraman wrote:
Thanks Bogdan, I will definitely try the devel (1.6). I cannot install
1.6 on the current server I have. I have to setup another box and then
try it out. I will let you know. Mean while I'm trying hard to make
xmpp2simple presence status work. Any help or pointer would be
appreciated.
Thanks
Mani
On Mon, Jun 29, 2009 at 11:04 AM, Bogdan-Andrei Iancu
<[email protected] <mailto:[email protected]>> wrote:
Hi Mani,
I fixed this on 1.6 (devel) version by adding fetch support in the
PUA module, so now it can add as many row as possible without any
mem issues. Could you give it a try? if you confirm the fix, I
will do a backport to 1.5 also.
Best regards,
Bogdan
mani sivaraman wrote:
I'm using opensips 1.5.1 for the past 1 week. Suddenly I get
this error below when starting. What is going on.
Jun 26 15:52:14 [2535] ERROR:core:db_allocate_rows: no memory left
Jun 26 15:52:14 [2535] ERROR:db_mysql:db_mysql_convert_rows:
no private memory left
Jun 26 15:52:14 [2535] ERROR:db_mysql:db_mysql_convert_result:
error while converting rows
Jun 26 15:52:14 [2535] DBG:core:db_free_columns: freeing
result columns at 0x81a9b78
Jun 26 15:52:14 [2535] ERROR:db_mysql:db_mysql_store_result:
error while converting result
Jun 26 15:52:14 [2535] ERROR:core:db_do_query: error while
storing resultJun 26 15:52:14 [2535] ERROR:pua:db_restore:
while querrying table
Jun 26 15:52:14 [2535] ERROR:pua:mod_init: while restoring
hash_table
Jun 26 15:52:14 [2535] ERROR:core:init_mod: failed to
initialize module pua
Jun 26 15:52:14 [2535] ERROR:core:main: error while
initializing modules
Jun 26 15:52:14 [2535] DBG:xmpp:destroy: cleaning up...
Jun 26 15:52:14 [2535] DBG:pua:destroy: destroying module ...
Jun 26 15:52:14 [2535] DBG:db_mysql:db_mysql_submit_query:
discon reset for 135960296
Jun 26 15:52:14 [2535] DBG:core:pool_remove: removing
connection from the pool
Jun 26 15:52:14 [2535] DBG:presence_xml:destroy: start
Jun 26 15:52:14 [2535] NOTICE:presence:destroy: destroy module ...
Jun 26 15:52:14 [2535] DBG:xlog:destroy: destroy module...
Jun 26 15:52:14 [2535] DBG:tm:tm_shutdown: tm_shutdown : start
Jun 26 15:52:14 [2535] DBG:tm:unlink_timer_lists: emptying
DELETE list
Jun 26 15:52:14 [2535] DBG:tm:tm_shutdown: emptying hash table
Jun 26 15:52:14 [2535] DBG:tm:tm_shutdown: releasing timers
Jun 26 15:52:14 [2535] DBG:tm:tm_shutdown: removing semaphores
Jun 26 15:52:14 [2535] DBG:tm:tm_shutdown: destroying callback
lists
Jun 26 15:52:14 [2535] DBG:tm:tm_shutdown: tm_shutdown : done
Jun 26 15:52:14 [2535] DBG:core:destroy_tls: entered
Jun 26 15:52:14 [2535] DBG:core:shm_mem_destroy:
Jun 26 15:52:14 [2535] DBG:core:shm_mem_destroy: destroying
the shared memory lock
------------------------------------------------------------------------
_______________________________________________
Users mailing list
[email protected] <mailto:[email protected]>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Index: modules/pua/pua.c
===================================================================
--- modules/pua/pua.c (revision 5804)
+++ modules/pua/pua.c (revision 5805)
@@ -338,17 +338,31 @@
LM_ERR("in use table\n");
return -1;
}
-
- if(pua_dbf.query(pua_db,0, 0, 0, result_cols,0, n_result_cols, 0,&res)< 0)
- {
- LM_ERR("while querrying table\n");
- if(res)
+
+ if (DB_CAPABILITY(pua_dbf, DB_CAP_FETCH)) {
+ if(pua_dbf.query(pua_db,0, 0, 0, result_cols,0, n_result_cols, 0,0)< 0)
{
- pua_dbf.free_result(pua_db, res);
- res = NULL;
+ LM_ERR("while querying table\n");
+ return -1;
}
- return -1;
+ if(pua_dbf.fetch_result(pua_db, &res, 500 /*rows*/)<0)
+ {
+ LM_ERR("Error fetching rows\n");
+ return -1;
+ }
+ } else {
+ if(pua_dbf.query(pua_db,0, 0, 0,result_cols,0,n_result_cols,0,&res)< 0)
+ {
+ LM_ERR("while querrying table\n");
+ if(res)
+ {
+ pua_dbf.free_result(pua_db, res);
+ res = NULL;
+ }
+ return -1;
+ }
}
+
if(res== NULL)
return -1;
@@ -362,200 +376,212 @@
LM_DBG("found %d db entries\n", res->n);
- for(i =0 ; i< res->n ; i++)
- {
- row = &res->rows[i];
- row_vals = ROW_VALUES(row);
-
- pres_uri.s= (char*)row_vals[puri_col].val.string_val;
- pres_uri.len = strlen(pres_uri.s);
-
- LM_DBG("pres_uri= %.*s\n", pres_uri.len, pres_uri.s);
-
- memset(&etag, 0, sizeof(str));
- memset(&tuple_id, 0, sizeof(str));
- memset(&watcher_uri, 0, sizeof(str));
- memset(&call_id, 0, sizeof(str));
- memset(&to_tag, 0, sizeof(str));
- memset(&from_tag, 0, sizeof(str));
- memset(&record_route, 0, sizeof(str));
- memset(&pres_id, 0, sizeof(str));
- memset(&contact, 0, sizeof(str));
- memset(&remote_contact, 0, sizeof(str));
- memset(&extra_headers, 0, sizeof(str));
-
- pres_id.s= (char*)row_vals[pid_col].val.string_val;
- if(pres_id.s)
- pres_id.len = strlen(pres_id.s);
-
- if(row_vals[etag_col].val.string_val)
+ do {
+ for(i =0 ; i< res->n ; i++)
{
- etag.s= (char*)row_vals[etag_col].val.string_val;
- etag.len = strlen(etag.s);
-
- tuple_id.s= (char*)row_vals[tuple_col].val.string_val;
- tuple_id.len = strlen(tuple_id.s);
- }
+ row = &res->rows[i];
+ row_vals = ROW_VALUES(row);
+
+ pres_uri.s= (char*)row_vals[puri_col].val.string_val;
+ pres_uri.len = strlen(pres_uri.s);
+
+ LM_DBG("pres_uri= %.*s\n", pres_uri.len, pres_uri.s);
+
+ memset(&etag, 0, sizeof(str));
+ memset(&tuple_id, 0, sizeof(str));
+ memset(&watcher_uri, 0, sizeof(str));
+ memset(&call_id, 0, sizeof(str));
+ memset(&to_tag, 0, sizeof(str));
+ memset(&from_tag, 0, sizeof(str));
+ memset(&record_route, 0, sizeof(str));
+ memset(&pres_id, 0, sizeof(str));
+ memset(&contact, 0, sizeof(str));
+ memset(&remote_contact, 0, sizeof(str));
+ memset(&extra_headers, 0, sizeof(str));
+
+ pres_id.s= (char*)row_vals[pid_col].val.string_val;
+ if(pres_id.s)
+ pres_id.len = strlen(pres_id.s);
- if(row_vals[watcher_col].val.string_val)
- {
- watcher_uri.s= (char*)row_vals[watcher_col].val.string_val;
- watcher_uri.len = strlen(watcher_uri.s);
+ if(row_vals[etag_col].val.string_val)
+ {
+ etag.s= (char*)row_vals[etag_col].val.string_val;
+ etag.len = strlen(etag.s);
- call_id.s= (char*)row_vals[callid_col].val.string_val;
- call_id.len = strlen(call_id.s);
+ tuple_id.s= (char*)row_vals[tuple_col].val.string_val;
+ tuple_id.len = strlen(tuple_id.s);
+ }
- to_tag.s= (char*)row_vals[totag_col].val.string_val;
- to_tag.len = strlen(to_tag.s);
+ if(row_vals[watcher_col].val.string_val)
+ {
+ watcher_uri.s= (char*)row_vals[watcher_col].val.string_val;
+ watcher_uri.len = strlen(watcher_uri.s);
+
+ call_id.s= (char*)row_vals[callid_col].val.string_val;
+ call_id.len = strlen(call_id.s);
+
+ to_tag.s= (char*)row_vals[totag_col].val.string_val;
+ to_tag.len = strlen(to_tag.s);
+
+ from_tag.s= (char*)row_vals[fromtag_col].val.string_val;
+ from_tag.len = strlen(from_tag.s);
+
+ if(row_vals[record_route_col].val.string_val)
+ {
+ record_route.s= (char*)
+ row_vals[record_route_col].val.string_val;
+ record_route.len= strlen(record_route.s);
+ }
+
+ contact.s= (char*)row_vals[contact_col].val.string_val;
+ contact.len = strlen(contact.s);
+
+ remote_contact.s=
+ (char*)row_vals[remote_contact_col].val.string_val;
+ remote_contact.len = strlen(remote_contact.s);
+ }
+ extra_headers.s= (char*)row_vals[extra_headers_col].val.string_val;
+ if(extra_headers.s)
+ extra_headers.len= strlen(extra_headers.s);
+ else
+ extra_headers.len= 0;
- from_tag.s= (char*)row_vals[fromtag_col].val.string_val;
- from_tag.len = strlen(from_tag.s);
+ size= sizeof(ua_pres_t)+ sizeof(str)+ (pres_uri.len+ pres_id.len+
+ tuple_id.len)* sizeof(char);
+ if(extra_headers.s)
+ size+= sizeof(str)+ extra_headers.len* sizeof(char);
- if(row_vals[record_route_col].val.string_val)
+ if(watcher_uri.s)
+ size+= sizeof(str)+ (watcher_uri.len+ call_id.len+ to_tag.len+
+ from_tag.len+ record_route.len+ contact.len)* sizeof(char);
+
+ p= (ua_pres_t*)shm_malloc(size);
+ if(p== NULL)
{
- record_route.s= (char*)row_vals[record_route_col].val.string_val;
- record_route.len= strlen(record_route.s);
- }
+ LM_ERR("no more share memmory");
+ goto error;
+ }
+ memset(p, 0, size);
+ size= sizeof(ua_pres_t);
- contact.s= (char*)row_vals[contact_col].val.string_val;
- contact.len = strlen(contact.s);
+ p->pres_uri= (str*)((char*)p+ size);
+ size+= sizeof(str);
+ p->pres_uri->s= (char*)p + size;
+ memcpy(p->pres_uri->s, pres_uri.s, pres_uri.len);
+ p->pres_uri->len= pres_uri.len;
+ size+= pres_uri.len;
- remote_contact.s= (char*)row_vals[remote_contact_col].val.string_val;
- remote_contact.len = strlen(remote_contact.s);
+ if(pres_id.s)
+ {
+ p->id.s= (char*)p + size;
+ memcpy(p->id.s, pres_id.s, pres_id.len);
+ p->id.len= pres_id.len;
+ size+= pres_id.len;
+ }
+ if(tuple_id.s && tuple_id.len)
+ {
+ p->tuple_id.s= (char*)p + size;
+ memcpy(p->tuple_id.s, tuple_id.s, tuple_id.len);
+ p->tuple_id.len= tuple_id.len;
+ size+= tuple_id.len;
+ }
- }
- extra_headers.s= (char*)row_vals[extra_headers_col].val.string_val;
- if(extra_headers.s)
- extra_headers.len= strlen(extra_headers.s);
- else
- extra_headers.len= 0;
+ if(watcher_uri.s && watcher_uri.len)
+ {
+ p->watcher_uri= (str*)((char*)p+ size);
+ size+= sizeof(str);
- size= sizeof(ua_pres_t)+ sizeof(str)+ (pres_uri.len+ pres_id.len+
- tuple_id.len)* sizeof(char);
- if(extra_headers.s)
- size+= sizeof(str)+ extra_headers.len* sizeof(char);
+ p->watcher_uri->s= (char*)p+ size;
+ memcpy(p->watcher_uri->s, watcher_uri.s, watcher_uri.len);
+ p->watcher_uri->len= watcher_uri.len;
+ size+= watcher_uri.len;
- if(watcher_uri.s)
- size+= sizeof(str)+ (watcher_uri.len+ call_id.len+ to_tag.len+
- from_tag.len+ record_route.len+ contact.len)* sizeof(char);
-
- p= (ua_pres_t*)shm_malloc(size);
- if(p== NULL)
- {
- LM_ERR("no more share memmory");
- goto error;
- }
- memset(p, 0, size);
- size= sizeof(ua_pres_t);
+ p->to_tag.s= (char*)p+ size;
+ memcpy(p->to_tag.s, to_tag.s, to_tag.len);
+ p->to_tag.len= to_tag.len;
+ size+= to_tag.len;
- p->pres_uri= (str*)((char*)p+ size);
- size+= sizeof(str);
- p->pres_uri->s= (char*)p + size;
- memcpy(p->pres_uri->s, pres_uri.s, pres_uri.len);
- p->pres_uri->len= pres_uri.len;
- size+= pres_uri.len;
-
- if(pres_id.s)
- {
- p->id.s= (char*)p + size;
- memcpy(p->id.s, pres_id.s, pres_id.len);
- p->id.len= pres_id.len;
- size+= pres_id.len;
- }
- if(tuple_id.s && tuple_id.len)
- {
- p->tuple_id.s= (char*)p + size;
- memcpy(p->tuple_id.s, tuple_id.s, tuple_id.len);
- p->tuple_id.len= tuple_id.len;
- size+= tuple_id.len;
- }
+ p->from_tag.s= (char*)p+ size;
+ memcpy(p->from_tag.s, from_tag.s, from_tag.len);
+ p->from_tag.len= from_tag.len;
+ size+= from_tag.len;
+
+ p->call_id.s= (char*)p + size;
+ memcpy(p->call_id.s, call_id.s, call_id.len);
+ p->call_id.len= call_id.len;
+ size+= call_id.len;
+
+ if(record_route.s && record_route.len)
+ {
+ p->record_route.s= (char*)p + size;
+ memcpy(p->record_route.s, record_route.s, record_route.len);
+ p->record_route.len= record_route.len;
+ size+= record_route.len;
+ }
+ p->contact.s= (char*)p + size;
+ memcpy(p->contact.s, contact.s, contact.len);
+ p->contact.len= contact.len;
+ size+= contact.len;
- if(watcher_uri.s && watcher_uri.len)
- {
- p->watcher_uri= (str*)((char*)p+ size);
- size+= sizeof(str);
+ p->cseq= row_vals[cseq_col].val.int_val;
- p->watcher_uri->s= (char*)p+ size;
- memcpy(p->watcher_uri->s, watcher_uri.s, watcher_uri.len);
- p->watcher_uri->len= watcher_uri.len;
- size+= watcher_uri.len;
+ p->remote_contact.s= (char*)
+ shm_malloc(remote_contact.len* sizeof(char));
+ if(p->remote_contact.s== NULL)
+ {
+ LM_ERR("No more shared memory\n");
+ goto error;
+ }
+ memcpy(p->remote_contact.s, remote_contact.s, remote_contact.len);
+ p->remote_contact.len= remote_contact.len;
+
+ p->version= row_vals[version_col].val.int_val;
+ }
- p->to_tag.s= (char*)p+ size;
- memcpy(p->to_tag.s, to_tag.s, to_tag.len);
- p->to_tag.len= to_tag.len;
- size+= to_tag.len;
-
- p->from_tag.s= (char*)p+ size;
- memcpy(p->from_tag.s, from_tag.s, from_tag.len);
- p->from_tag.len= from_tag.len;
- size+= from_tag.len;
-
- p->call_id.s= (char*)p + size;
- memcpy(p->call_id.s, call_id.s, call_id.len);
- p->call_id.len= call_id.len;
- size+= call_id.len;
-
- if(record_route.s && record_route.len)
+ if(extra_headers.s)
{
- p->record_route.s= (char*)p + size;
- memcpy(p->record_route.s, record_route.s, record_route.len);
- p->record_route.len= record_route.len;
- size+= record_route.len;
+ p->extra_headers= (str*)((char*)p+ size);
+ size+= sizeof(str);
+ p->extra_headers->s= (char*)p+ size;
+ memcpy(p->extra_headers->s, extra_headers.s, extra_headers.len);
+ p->extra_headers->len= extra_headers.len;
+ size+= extra_headers.len;
}
- p->contact.s= (char*)p + size;
- memcpy(p->contact.s, contact.s, contact.len);
- p->contact.len= contact.len;
- size+= contact.len;
- p->cseq= row_vals[cseq_col].val.int_val;
+ LM_DBG("size= %d\n", size);
+ p->event= row_vals[event_col].val.int_val;
+ p->expires= row_vals[expires_col].val.int_val;
+ p->desired_expires= row_vals[desired_expires_col].val.int_val;
+ p->flag|= row_vals[flag_col].val.int_val;
- p->remote_contact.s= (char*)shm_malloc(remote_contact.len* sizeof(char));
- if(p->remote_contact.s== NULL)
+ memset(&p->etag, 0, sizeof(str));
+ if(etag.s && etag.len)
{
- LM_ERR("No more shared memory\n");
- goto error;
+ /* alloc separately */
+ p->etag.s= (char*)shm_malloc(etag.len* sizeof(char));
+ if(p->etag.s== NULL)
+ {
+ LM_ERR("no more share memory\n");
+ goto error;
+ }
+ memcpy(p->etag.s, etag.s, etag.len);
+ p->etag.len= etag.len;
}
- memcpy(p->remote_contact.s, remote_contact.s, remote_contact.len);
- p->remote_contact.len= remote_contact.len;
-
- p->version= row_vals[version_col].val.int_val;
- }
+ print_ua_pres(p);
+ insert_htable(p);
+ } /* end for(all rows)*/
- if(extra_headers.s)
- {
- p->extra_headers= (str*)((char*)p+ size);
- size+= sizeof(str);
- p->extra_headers->s= (char*)p+ size;
- memcpy(p->extra_headers->s, extra_headers.s, extra_headers.len);
- p->extra_headers->len= extra_headers.len;
- size+= extra_headers.len;
- }
-
- LM_DBG("size= %d\n", size);
- p->event= row_vals[event_col].val.int_val;
- p->expires= row_vals[expires_col].val.int_val;
- p->desired_expires= row_vals[desired_expires_col].val.int_val;
- p->flag|= row_vals[flag_col].val.int_val;
-
- memset(&p->etag, 0, sizeof(str));
- if(etag.s && etag.len)
- {
- /* alloc separately */
- p->etag.s= (char*)shm_malloc(etag.len* sizeof(char));
- if(p->etag.s== NULL)
- {
- LM_ERR("no more share memory\n");
+ if (DB_CAPABILITY(pua_dbf, DB_CAP_FETCH)) {
+ if(pua_dbf.fetch_result(pua_db, &res, 500/*rows*/)<0) {
+ LM_ERR( "fetching rows (1)\n");
goto error;
- }
- memcpy(p->etag.s, etag.s, etag.len);
- p->etag.len= etag.len;
+ }
+ } else {
+ break;
}
+ } while(RES_ROW_N(res)>0);
- print_ua_pres(p);
- insert_htable(p);
- }
-
pua_dbf.free_result(pua_db, res);
res = NULL;
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users