Hello,

Have you found the way to run SELECT COUNT(*) ?
I use kamailio 3.2.4 with sqlite 3.7.5-1 and it crashes on such queries too.

As a workaround I use $dbr(res=>rows) with "SELECT some_field FROM table" query, but the bug is really exists.

Hello Timo,

We've done a basic test and it seems to solve the memory leak problem. We'll do exhaustive tests in a few days.

We'll keep you informed.

Thanks a lot,
Pedro




De:        Timo Teras <timo.teras@iki.fi>
Para:        "SIP Router - Kamailio \(OpenSER\) and SIP Express Router \(SER\) - Users Mailing List" <sr-users@lists.sip-router.org>
cc:        pvsolano@amper.es
Fecha:        15/10/2012 16:13
Asunto:        Re: [SR-Users] db_sqlite bugs
Enviado por:        Timo Teräs <timo.teras@gmail.com>




On Thu, 11 Oct 2012 12:37:23 +0200 Pedro Antonio Vico Solano
<pvsolano@amper.es> wrote:

> Hello everyone,
>
> We are developing a solution based on the SQLite module for Kamailio
> and we've found some bugs/errors regarding it. We use kamailio 3.2.4
> and SQLite 3.7.14.1. The errors are about this:
>
> - Memory leaks on querys via sqlops. Kamailio main process leaks 4kB
> each 3 queries (aprox.) and that memory is never freed. [Attached
> basic example]
> - Segmentation fault when doing a SELECT COUNT(*) via sqlops.
> [Attached basic example 2]
>
> Can you help us?

Does this help for the memory leak?

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;
}

Seems that all other database driver postpone the resource release to
free_results - but there's no reason why we couldn't do this right away
in sqlite. Since in sqlite free_results we just free cached result set.

Will take a look at the other bug later when I get the time to
reproduce it.

-Timo


ADVERTENCIA


Este mensaje y/o sus anexos, pueden contener información personal y confidencial cuyo uso, reproducción o distribución no autorizados están legalmente prohibidos. Por lo tanto, si Vd. no fuera su destinatario y, erróneamente, lo hubiera recibido, le rogamos que informe al remitente y lo borre de inmediato.

En cumplimiento de la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal le informamos de que su dirección de correo electrónico, así como sus datos personales y de empresa pasarán a formar parte de nuestro fichero de Gestión, y serán tratados con la única finalidad de mantenimiento de la relación adquirida con usted. Los datos personales que existen en nuestro poder están protegidos por nuestra Política de Seguridad, y no serán compartidos con ninguna otra empresa. Usted puede ejercitar los derechos de acceso, rectificación, cancelación y oposición dirigiéndose por escrito a la dirección arriba indicada.

This e-mail and its attachments may include confidential personal information which may be protected by any legal rules and cannot be used, copied, distributed or disclosed to any person without authorisation. If you are not the intended recipient and have received this e-mail by mistake, please advise the sender and erase it.

In compliance with the Spanish Organic Act 15/1999 on Personal Data Protection, we hereby inform you that your email address, as well as your personal and business information, will be included in our Management files and used solely for purposes corresponding to our commercial relationship. All personal data in our possession is protected by our Data Safety Policy and thus shall not be released to any other third party whatsoever. You may exercise your right to access, rectify, cancel and contest by writing to the address provided above.


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users