As suggested in this thread
(http://groups.google.com/group/turbogears/browse_frm/thread/eeb289d5a0ca36f9/d2cd5f7ee2674082?q=mysql+server+away&rnum=1#d2cd5f7ee2674082)
I tried modifying the __get__ method in class PackageHub. It catches
the exception ok
but self.set_hub() doesn't seem to reset the connection.
I also tried catching the exception in SQLObject's mysqlconnection.py,
recalling MySQLConnection.makeConnection(). This also doesn't seem to
help.
I'm running TG0.8.8. Would upgrading help?
Thanks for any leads!
Paul
http://pauleastham.com
However it is actually possible, although unlikely I've found, for a
connection to die and having a reconnection strategy would be a good
thing.
Justin
Paul
But since Mysql 5.0.3 auto-reconnect is disabled by default (it was
enabled by default previosly) since it's considered dangerous (you
silently loose all the connection state).
http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-4-1.html
Indeed, I have noticed in the past that this is possible. We really
should attempt to fix the bug at the source - will this require
modifying SQLObject or can it be done in TG?
-Rob
>
> Justin
I'm 99% sure it is the ORM code (does this happen with SQL Alchemy?) or even
lower, at driver level... We can, maybe, do some workaround on TG's side,
but...
--
Jorge Godoy <jgo...@gmail.com>
The essential part of the solution is to make the following call after
the mysql_real_connect() in
_mysql.c:_mysql_ConnectionObject_Initialize():
my_bool bool = 1;
mysql_options(conn, MYSQL_OPT_RECONNECT, &bool);
I'll submit a patch to MySQLdb at sourceforge that exposes an interface
for this, so that the behavior may be controlled by SQLObject/TG. If
anyone wants this patch (which is a bit long to post due to all the
C/python API stuff), just send an email.
Paul
--
Paul Eastham eas...@gmail.com http://pauleastham.com
This is awesome!
If you could post the patch in a ticket on the TurboGears or SQL
Object Trac that would be great. That way when/if the MySQLdb patch
makes it in we can push forward with the SQLObject side of things.
--
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog