Hi Daniel

thanks a lot. I will certainly test it in the following days, I will post the results.

Regards

Javi

On Tue, Jan 11, 2011 at 11:18 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hello,

just committed a patch on master branch that should attempt to reconnect to postgres server if the connection was lost. There are three attempts to execute the query before giving up.

I have no meanings at this time to test it, if you can do it and report whether it works or not, will be appreciated. Somehow this is in between a bug and feature, since the parameter existed in the module (nameed retries), but was implemented only for DB API v2, so it can be backported to be also available for DB API v1 (which is the one used by kamailio modules right now).

Thanks,
Daniel

On 1/4/11 5:54 PM, Alex Balashov wrote:
On 01/04/2011 09:46 AM, Javier Gallart wrote:
Hi list

we have been testing the mtree module. We do periodical reloads of the
mtree table with the "mi mt_reload" command through xmlrpc. It works
fine except when the db is restarted. If we manually restart the db and
then try the mt_reload commands we get this error:
Jan  4 09:13:17 server /usr/local/kamailio-3.1.1/sbin/kamailio[28534]:
ERROR: db_postgres [km_dbase.c:152]: 0xa6a490 PQsendQuery Error: server
closed the connection unexpectedly#012#011This probably means the server
terminated abnormally#012#011before or while processing the request.#012
Query: select partition,prefix,route from trees  order by partition
Jan  4 09:13:17 server /usr/local/kamailio-3.1.1/sbin/kamailio[28534]:
ERROR: <core> [db_query.c:101]: error while submitting query
Jan  4 09:13:17 server /usr/local/kamailio-3.1.1/sbin/kamailio[28534]:
ERROR: mtree [mtree_mod.c:622]: Error while querying db
Jan  4 09:13:17 server /usr/local/kamailio-3.1.1/sbin/kamailio[28534]:
ERROR: mtree [mtree_mod.c:738]: cannot re-load info from database

Is there a way to reconnect to the db before sending that command?

Failure to automatically reconnect to Postgres is one of the distinguishing features of db_postgres in contrast to db_mysql for the moment.


--
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
http://www.asipto.com