[Zope3-dev] rdb: Disappearing Connection redux

Jan-Wijbrand Kolman jw at infrae.com
Thu Feb 9 05:54:18 EST 2006


Hi Jim,


Jim Washington wrote:
> The situation I wish to handle is the case where MySQL server silently 
> closes its connection with Zope after 8 hours idle, which likely will 
> happen at least once a day.
> 
> What seems to work for me now is the following as 
> mysqldbda.adapter.MySQLdbAdapter.isConnected()
> 
> def isConnected(self):
>        try:
>            self._v_connection.ping()
>        except:
>            # not connected or ping did not restore MySQL connection
>            if self._v_connection is not None:
>                self._v_connection.close()
>                self._v_connection = None
>            return False
>        return True

After experiencing 'Mysql server had gone away' errors I quickly found 
this thread.

If I interpret the course of discussion correctly, the above isConnected 
implementation solved this problem for you, right?

I add this implementation of isConnected to the mysqldbda in my setup 
(Zope-2.9 + Five + sqlos, mysql 4.1.12) too, and things *seem* to have 
improved. But not completely, every now and then I get the gone away 
errors again.

Question is, was this indeed the final conclusion for this thread and 
did it solve the problem for you completely - i.e. do you not get the 
gone away errors anymore?

kind regards,
jw

-- 
Jan-Wijbrand Kolman
jw at infrae.com


More information about the Zope3-dev mailing list