On Jan 12, 2011, at 6:20 AM, cd...@peermore.com wrote:

> 
> 
> On Dec 9 2010, 6:52 pm, Michael Bayer <mike...@zzzcomputing.com>
> wrote:
>> Use the latest 0.6 release, MySQL reconnect detection had a bug up until 
>> 0.6.5.
>> 
>> When a disconnect occurs, you need to suffer at least one exception throw.  
>> When it occurs, the engine then disposes its pool of connections.  The 
>> subsequent connections will the proceed assuming the DB is back up.
> 
> I'm not sure I'm completely understanding you here. Are you saying
> that up through 0.6.5 you have to suffer the one throw and you do not
> in 0.6.6, or that things were worse before 0.6.6, but now in 0.6.6
> things will work okay after the one throw?

SQLAlchemy cannot suppress the throw of the exception, since it's not feasible 
for it to record every statement made within a particular transaction such that 
the entire operation could be replayed, nor would that be a great idea from a 
"surprise behavior" perspective.

In 0.6.6, the issue was fixed such that when a disconnect exception occurs, the 
current connection pool is discarded along with all of its connections and 
replaced with a new one, so that the next operation after recovery from the 
exception (or operations that begin in other threads) will be on a newly 
checked out connection.   All the other backends do this as well.

> 
> I'm having the server has gone away problem on a moderately busy web
> app. I'm using sqlalchemy 0.6.6, mysql 5.0.51. Connection pool logging
> shows that I'm correctly returning connections to the pool. The latest
> time the error has happened, it was on a connection that hasn't been
> used for about 12 minutes (other connections are actively being used
> in the intervening minutes). pool_recycle is set to 3600.
> 
> Do I need to use something like the LookLively listener described in
> http://groups.google.com/group/sqlalchemy/msg/a4ce563d802c929f to
> avoid suffering any exceptions?

I've never seen that issue before and it appears like something specific to 
your MySQL version or installation, network, or perhaps specific usage in your 
apps.    For example, code which accesses the underlying DBAPI connection and 
calls close() on it would cause this issue.   Rather than adding more layers to 
hide the problem, I'd make it my goal to track down why you're getting 
unexplained disconnects.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to