i think the error youre getting is a good thing; it shows that cursors are hanging open on a single connection before it gets back to the MySQLDB.
so here are some questions: are you using a distinct Session for each thread ? or are you using some module-level Session that is shared amongst threads ? the latter is not supported. are you using any explicit SessionTransactions ? if so, same question - are they used local to a single thread, and properly closed out before a request is completed ? are you using any explicit engine/connection operations, or strictly Session/Query operations ? do you have garbage collection disabled ? On Sep 20, 2006, at 4:32 AM, Sébastien LELONG wrote: > OK, I've just tried the patch. > > I've checked out SA from svn at revision 1873, applied the patch, > and tested > the whole, using several cherrypy threads (thread_pool = 10). > > This did not resolved the problem for me, as I get the error you > described > ("This connection still has X open cursors"). Here's the traceback: > > > Traceback (most recent call last): > > File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/ > cherrypy/_cphttptools.py", > line 110, in _run > applyFilters('before_finalize') > > File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/ > cherrypy/filters/__init__.py", > line 151, in applyFilters > method() > File "/home/slelong/Documents/Projects/dsf/tucos/filters/ > audit.py", line 94, > in before_finalize > self.feed_audit() > File "/home/slelong/Documents/Projects/dsf/tucos/filters/ > audit.py", line 82, > in feed_audit > aa.flush() > File "build/bdist.linux-i686/egg/sqlalchemy/ext/assignmapper.py", > line 16, > in do > File "build/bdist.linux-i686/egg/sqlalchemy/orm/session.py", line > 234, in > flush > File "build/bdist.linux-i686/egg/sqlalchemy/orm/unitofwork.py", > line 211, in > flush > File "build/bdist.linux-i686/egg/sqlalchemy/orm/session.py", line > 49, in > commit > File "build/bdist.linux-i686/egg/sqlalchemy/orm/session.py", line > 61, in > close > File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line > 235, in > close > File "build/bdist.linux-i686/egg/sqlalchemy/pool.py", line 207, > in close > File "build/bdist.linux-i686/egg/sqlalchemy/pool.py", line 212, > in _close > InvalidRequestError: This connection still has 1 open cursors > > > > Cheers, > > > Seb > > -- > Sébastien LELONG > > > > > On Tuesday 19 September 2006 22:35, Michael Bayer wrote: >> hey there - >> >> attached is another patch, which affects the instrumented Cursor and >> Connection objects so that it is impossible to return a connection to >> the pool without all cursors being closed; it throws an error >> otherwise. >> >> after running all the unit tests with SA, the only time this happens >> is during a rollback(); i added an extra step to rollback to >> explicitly close all open cursors after rolling back to fix that >> issue. >> >> so when you apply this patch, im hoping that it either fixes the >> problem, or you suddenly get lots of errors saying "This connection >> still has X open cursors", which will pinpoint exactly where cursors >> are staying open when connections are being returned to the pool. >> >> because it will potentially raise a bunch of errors im trying to hold >> off on committing this patch just yet. >> >> give it a try ! also attached to ticket # 306. > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys -- and earn > cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Sqlalchemy-users mailing list > Sqlalchemy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users