hey karl -

perhaps MySQLDB is not doing a good job of cleaning up cursors.  and  
when i just looked, i saw that SQLAlchemy isnt either.  try this patch:

Index: lib/sqlalchemy/engine/base.py
===================================================================
--- lib/sqlalchemy/engine/base.py       (revision 1866)
+++ lib/sqlalchemy/engine/base.py       (working copy)
@@ -564,6 +564,7 @@
      def close(self):
          if not self.closed:
              self.closed = True
+            self.cursor.close()
              if self.connection.should_close_with_result and  
self.dialect.supports_autoclose_results:
                  self.connection.close()


which simply adds an explicit close() to the ResultProxy's cursor.

On Sep 13, 2006, at 9:44 PM, Karl Guertin wrote:

> On 9/13/06, Michael Bayer <[EMAIL PROTECTED]> wrote:
>> theres a new option "pool_recycle" which will cause a connection to
>> be automatically closed and reopened after a given number of seconds,
>> you might want to try that.
>
> I guess I could just set it to something like 2 minutes so it cycles
> between my 5 minute updates, but it'd be nice if I could manually
> force a recycle of all connections.
>
>> is there some known way to reproduce this condition ?
>
> I'm actually embarrassed to say that I can't provide either a test
> case or steps to reproduce, I hate reporting bugs like this because
> there's not really anything you can do to solve them. As I hinted,
> it's intermittent and my connection is about 70% reliable. Sometimes
> the app runs for 6 hours, sometimes I get it on the first query.
> That's the problem. I've been trying to filter it down to a reduced
> test case because I know that's what you'd want (and what I want when
> I get bug reports), but I've been unable to reliably reproduce the
> state.
>
> The most common case is the one stated above, where the connection
> gets dropped in the middle of a query and subsequent tries are out of
> sync, but I rarely get into the sync condition without a disconnected
> traceback in my error log.  I'm not sure if this is carryover from a
> previously broken state or that the connection can get dropped between
> queries and put it in the out of sync state. As if that weren't
> annoying enough, not every dropped connection results in the out of
> sync state but most do. I suspect the ones that don't are ones that
> have only one result in the resultset but I'm not sure of that either.
>
> Sorry if the above sounds rather confused, I've been poking at this
> for a couple weeks trying to figure out if the error is in my code, my
> environment, or the libraries I'm using. I'm still not certain the
> problem is sqlalchemy or mysqldb, but I figured I could use the help
> in recovering and see if anybody else had ever encountered this
> problem.
>
> In any event, I'll continue logging my errors and see if I can find a
> consistent pattern if not a test case. It'd be helpful if I could
> figure out how to reliably cause a disconnect that doesn't involve
> yanking the network cable out of my machine (not that I've gotten to
> that point yet).
>
> In my googling of the problem the most promising explanation is
> here[1]. More specific queries for python or the mysqldb module
> haven't returned anything that looks like it would apply.
>
> [1] http://docsrv.caldera.com:8457/cgi-bin/info2html?(mysql.info.gz) 
> Commands%2520out%2520of%2520sync


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to