[sr-dev] [patch] invalid type (3) or nul (0) version columns for trusted (kamailio 3.1 with db_postgres latest from git)
Daniel-Constantin Mierla
miconda at gmail.com
Tue Nov 30 22:10:21 CET 2010
Hello,
I missed this patch, due to some traveling. It is good in my opinion,
but a different purpose.
Kamailio processes should not share a database connection as well.
Storing the pid inside db connection structure is good to discover that
some module does a fault DB initialization. Your investigation really
helps a lot, thanks!
Cheers,
Daniel
On 10/21/10 5:53 PM, Robert Verspuy wrote:
> I found the cause of my issue.
>
> In the source lib/srdb1/* some kind of pooling is used.
> When kamailio needs a database connection, the cmp_db_id function
> checks to see if there is already a database connection with the exact
> same params (username, database, server etc..).
>
> According to the PQ library every proces / thread should have it's own
> database connection.
> The db_postgres is setup to use asynchronous I/O with the PQ library.
> So when two threads are using the same database connection it is
> possible that,
> the resultset from a query of thread A is returned to thread B.
> The cmp_db_id function in lib/srdb1/db_id.c does _not_ check the PID.
>
> I've created a small patch to fix the problems mentioned above.
>
> The changes are made in lib/srdb1/* files
> So if you apply them, it will be active for _every_ database module.
> Maybe it's not needed for the mysql database,
> but I *assume* it will not break when used on a mysql database. (not
> tested)
> Maybe you will get a bit more database connections, but that depends
> on which modules you're using.
>
> What did I do:
>
> * Added pid to the db_id struct.
> * During initialization the pid is saved into the db_id struct.
> * In cmp_db_id the pid is also checked when searching for a
> database connection to be reused.
>
> With kind Regards,
> Robert Verspuy
>
> --
> *Exa-Omicron*
> Patroonsweg 10
> 3892 DB Zeewolde
> Tel.: 088-OMICRON (66 427 66)
> http://www.exa-omicron.nl
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
--
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
http://www.asipto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20101130/a424d4fb/attachment.htm>
More information about the sr-dev
mailing list