[sr-dev] DB API and connection keepalive

Henning Westerholt henning.westerholt at 1und1.de
Tue Sep 22 13:15:38 CEST 2009


On Dienstag, 22. September 2009, Jason Penton wrote:
> > you're right that its not executed with a timer or similar, but the
> > mysql_ping() should reconnect to the database if the auto reconnect is
> > activated, according the documentation:
> >
> >
> > http://dev.mysql.com/doc/refman/5.0/en/mysql-ping.html
>
> Actually the reconnect doesnt work if your firewall has torn down the
> connection. You can try this with other mysql clients like - the usual
> client, toad, etc. Leave your connection idle for about 45 mins and you
> will see that there's nothing you can do to reconnect.

Hi Jason,

ok, i'd just re-configure the firewall to not be stateful anymore, this is 
easier as working around in the application IMHO. But perhaps this is not 
possible in your case.

> I have tested this extensively and can only imageine that because the
> firewall has closed the connection, the reconnect in mysql doesnt work -
> because the socket has been torn down underneath mysql (at the OS level).
> So effectively you see a hangin process in Kamailio up to 5 minutes :)
> which is REALLLLLLLLY bad :D

This is strange, do you've tried to set the timeout_interval parameter? We do 
regularly tests where we block on network level all connections to the mysql, 
and it notices this and reports an error to the upper level. Perhaps the mysql 
version you use not supports this parameter? You find in the mod docs the 
versions.

> Ok so I am going to go ahead with using a timer to ping the mysql cons in
> the db_pool. Everyone happy with that?

As Daniel already mentioned, you need to ping from the individual process and 
not the timer process, otherwise it probably will not work.

Regards,

Henning
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20090922/623452fe/attachment.htm>


More information about the sr-dev mailing list