Module: sip-router
Branch: 3.2
Commit: 4d674b9715873d06f3856215a6da3f5594b30f73
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4d674b9…
Author: Timo Teräs <timo.teras(a)iki.fi>
Committer: Timo Teräs <timo.teras(a)iki.fi>
Date: Thu Nov 15 16:11:41 2012 +0200
modules_k/db_sqlite: fix crash with computed fields in custom queries
Computed fields do not have decltype available, so guess the proper
field type based on the result type of the first row. This does not
work if the first row has null type as result, but is the best we can
do easily and fixes gives right result in most cases.
Reported-by: Pedro Antonio Vico Solano <pvsolano(a)amper.es>
(cherry picked from commit 09205865f98136e0354539f09f4961ca016a915b)
---
modules_k/db_sqlite/dbase.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/modules_k/db_sqlite/dbase.c b/modules_k/db_sqlite/dbase.c
index d5dc058..f88ce7a 100644
--- a/modules_k/db_sqlite/dbase.c
+++ b/modules_k/db_sqlite/dbase.c
@@ -265,6 +265,24 @@ static int decltype_to_dbtype(const char *decltype)
return DB1_INT;
}
+static int type_to_dbtype(int type)
+{
+ switch (type) {
+ case SQLITE_INTEGER:
+ return DB1_INT;
+ case SQLITE_FLOAT:
+ return DB1_DOUBLE;
+ case SQLITE_TEXT:
+ return DB1_STR;
+ case SQLITE_BLOB:
+ return DB1_BLOB;
+ default:
+ /* Unknown, or NULL column value. Assume this is a
+ * string. */
+ return DB1_STR;
+ }
+}
+
static str* str_dup(const char *_s)
{
str *s;
@@ -325,10 +343,18 @@ int db_sqlite_store_result(const db1_con_t* _h, db1_res_t** _r)
RES_COL_N(res) = rc;
for (i = 0; i < RES_COL_N(res); i++) {
+ const char *decltype;
+ int dbtype;
+
RES_NAMES(res)[i] = str_dup(sqlite3_column_name(conn->stmt, i));
if (RES_NAMES(res)[i] == NULL)
goto no_mem;
- RES_TYPES(res)[i] = decltype_to_dbtype(sqlite3_column_decltype(conn->stmt, i));
+ decltype = sqlite3_column_decltype(conn->stmt, i);
+ if (decltype != NULL)
+ dbtype = decltype_to_dbtype(decltype);
+ else
+ dbtype = type_to_dbtype(sqlite3_column_type(conn->stmt, i));
+ RES_TYPES(res)[i] = dbtype;
}
}
if (num_rows >= num_alloc) {
Module: sip-router
Branch: 3.2
Commit: 98197e56b283e24570eb71d7418b5ec6491cef62
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=98197e5…
Author: Timo Teräs <timo.teras(a)iki.fi>
Committer: Timo Teräs <timo.teras(a)iki.fi>
Date: Wed Oct 17 09:00:14 2012 +0300
modules_k/db_sqlite: fix memory leak in sqlops query
Seems that most other database drivers release the database
resource only at free_result time, which I some how missed.
Since we are doing a deep copy in store_result(), we can
just release the sqlite resources immediately raw_query().
Reported-by: Pedro Antonio Vico Solano <pvsolano(a)amper.es>
(cherry picked from commit ecf95eb0ada8bfacb93af7b82f39347c841229e4)
---
modules_k/db_sqlite/dbase.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/modules_k/db_sqlite/dbase.c b/modules_k/db_sqlite/dbase.c
index 67db13b..d5dc058 100644
--- a/modules_k/db_sqlite/dbase.c
+++ b/modules_k/db_sqlite/dbase.c
@@ -520,7 +520,12 @@ int db_sqlite_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
int db_sqlite_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r)
{
- return db_do_raw_query(_h, _s, _r,
+ int rc;
+
+ rc = db_do_raw_query(_h, _s, _r,
db_sqlite_submit_query,
db_sqlite_store_result);
+ db_sqlite_cleanup_query(_h);
+
+ return rc;
}
Module: sip-router
Branch: 3.3
Commit: bab07e07858464d50d310bbb52431a0b171ee771
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bab07e0…
Author: Timo Teräs <timo.teras(a)iki.fi>
Committer: Timo Teräs <timo.teras(a)iki.fi>
Date: Thu Nov 15 16:11:41 2012 +0200
modules_k/db_sqlite: fix crash with computed fields in custom queries
Computed fields do not have decltype available, so guess the proper
field type based on the result type of the first row. This does not
work if the first row has null type as result, but is the best we can
do easily and fixes gives right result in most cases.
Reported-by: Pedro Antonio Vico Solano <pvsolano(a)amper.es>
(cherry picked from commit 09205865f98136e0354539f09f4961ca016a915b)
---
modules_k/db_sqlite/dbase.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/modules_k/db_sqlite/dbase.c b/modules_k/db_sqlite/dbase.c
index c1d3b71..c4df4ce 100644
--- a/modules_k/db_sqlite/dbase.c
+++ b/modules_k/db_sqlite/dbase.c
@@ -288,6 +288,24 @@ static int decltype_to_dbtype(const char *decltype)
return DB1_INT;
}
+static int type_to_dbtype(int type)
+{
+ switch (type) {
+ case SQLITE_INTEGER:
+ return DB1_INT;
+ case SQLITE_FLOAT:
+ return DB1_DOUBLE;
+ case SQLITE_TEXT:
+ return DB1_STR;
+ case SQLITE_BLOB:
+ return DB1_BLOB;
+ default:
+ /* Unknown, or NULL column value. Assume this is a
+ * string. */
+ return DB1_STR;
+ }
+}
+
static str* str_dup(const char *_s)
{
str *s;
@@ -348,10 +366,18 @@ int db_sqlite_store_result(const db1_con_t* _h, db1_res_t** _r)
RES_COL_N(res) = rc;
for (i = 0; i < RES_COL_N(res); i++) {
+ const char *decltype;
+ int dbtype;
+
RES_NAMES(res)[i] = str_dup(sqlite3_column_name(conn->stmt, i));
if (RES_NAMES(res)[i] == NULL)
goto no_mem;
- RES_TYPES(res)[i] = decltype_to_dbtype(sqlite3_column_decltype(conn->stmt, i));
+ decltype = sqlite3_column_decltype(conn->stmt, i);
+ if (decltype != NULL)
+ dbtype = decltype_to_dbtype(decltype);
+ else
+ dbtype = type_to_dbtype(sqlite3_column_type(conn->stmt, i));
+ RES_TYPES(res)[i] = dbtype;
}
}
if (num_rows >= num_alloc) {
Module: sip-router
Branch: 3.3
Commit: 8198f2dcc92127bc15ac13f71372f016b8c982d9
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8198f2d…
Author: Timo Teräs <timo.teras(a)iki.fi>
Committer: Timo Teräs <timo.teras(a)iki.fi>
Date: Wed Oct 17 09:00:14 2012 +0300
modules_k/db_sqlite: fix memory leak in sqlops query
Seems that most other database drivers release the database
resource only at free_result time, which I some how missed.
Since we are doing a deep copy in store_result(), we can
just release the sqlite resources immediately raw_query().
Reported-by: Pedro Antonio Vico Solano <pvsolano(a)amper.es>
(cherry picked from commit ecf95eb0ada8bfacb93af7b82f39347c841229e4)
---
modules_k/db_sqlite/dbase.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/modules_k/db_sqlite/dbase.c b/modules_k/db_sqlite/dbase.c
index 0b32e07..c1d3b71 100644
--- a/modules_k/db_sqlite/dbase.c
+++ b/modules_k/db_sqlite/dbase.c
@@ -543,7 +543,12 @@ int db_sqlite_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
int db_sqlite_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r)
{
- return db_do_raw_query(_h, _s, _r,
+ int rc;
+
+ rc = db_do_raw_query(_h, _s, _r,
db_sqlite_submit_query,
db_sqlite_store_result);
+ db_sqlite_cleanup_query(_h);
+
+ return rc;
}
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#254 - uacreg functionality: kamailio sending zeroes in header
User who did this - Daniel-Constantin Mierla (miconda)
----------
Can you paste here the parameters for uac module and the sample database record to try to reproduce?
----------
More information can be found at the following URL:
https://sip-router.org/tracker/index.php?do=details&task_id=254#comment749
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Rus (Sfinx)
Attached to Project - sip-router
Summary - uacreg functionality: kamailio sending zeroes in header
Task Type - Bug Report
Category - Modules kamailio
Status - Unconfirmed
Assigned To -
Operating System - Linux
Severity - Medium
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - Current kamailio.git, module uac, uacreg functionality not working, seeing in tcpdump :
........
00:50:38.312534 IP (tos 0x0, ttl 57, id 3428, offset 0, flags [none],
proto UDP (17), length 441)
8X.XXX.XXX.XX.5060 > 7X.XX.XXX.XXX.5060: SIP, length: 413
REGISTER sip:demo.host.com SIP/2.0
Via:
SIP/\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0
x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x
00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x0
0\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00
\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00
....
Here we can see that register header starts as normal, but suddenly filled
with zeroes by kamailio till the packet end.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=254
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Hello,
Inserted record to uacreg table, started kamailio and seeing this
with tcpdump :
00:50:38.312534 IP (tos 0x0, ttl 57, id 3428, offset 0, flags [none],
proto UDP (17), length 441)
8X.XXX.XXX.XX.5060 > 7X.XX.XXX.XXX.5060: SIP, length: 413
REGISTER sip:demo.host.com SIP/2.0
Via:
SIP/\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00
....
As you can see - register header starts as normal, but suddenly filled
with zeroes by kamailio till the packet end.
What can be the problem ? Tried to define UAC_OLD_AUTH in uac_reg.c with
no effect. Seems like uacreg logic is broken in git.
Rus
Hi,
Yesterday we experienced a memory leak in a Kamailio installation that have
not experienced a problem in 3 years.
The following logs are seen at the time the shared memory consumption
started growing:
CRITICAL:dialog:log_next_state_dlg: bogus event 7 in state 1 for dlg
0x7f229d854ec0 [2105:1480707518] with clid '
6685e5d44ebed43d0c0338f632c8442a(a)10.253.54.8' and tags 'as0c5f3f9b'
..with different clid, tag and dlg values of course.
As I can see this log is fired when a BYE is received for a dlg_managed
call wich state is '1' (DLG_STATE_UNCONFIRMED)
I can't see this fixed in the changelog for newer Kamailio versions. Has
anyone experienced this problem before, or know if it is solved in recent
versions?
Thanks a lot