On Mar 4, 2012, at 6:38 PM, Chris Withers wrote: > Hi All, > > I have a projects using SQLAlchemy 0.6.1 on a Zope app server where I have a > SQLAlchemy session that's basically used to call a set of about 3 MySQL > stored procedures to do some auth checks for the app. Sadly these stored > procs are not maintained by me, and while I suspect they're the cause of this > issue, I can't do much about them... > > Every so often, I get MySQL InnoDB transactions that report their state as > '', with no transaction info according to the MySQL processlist table, but > which are active according to the INNODB_TRX table. > > That in itself is weird, and if anyone knows what that means or how to solve > it, I'm very interested ;-) > > However, if I use mysql's kill statement to kill the thread associated with > that transaction, I then get the following error message in the Zope logs: > > Module sqlalchemy.orm.session, line 724, in execute > Module sqlalchemy.engine.base, line 1191, in execute > Module sqlalchemy.engine.base, line 1271, in _execute_clauseelement > Module sqlalchemy.engine.base, line 1302, in __execute_context > Module sqlalchemy.engine.base, line 1401, in _cursor_execute > Module sqlalchemy.engine.base, line 1394, in _cursor_execute > Module sqlalchemy.engine.default, line 299, in do_execute > Module MySQLdb.cursors, line 174, in execute > Module MySQLdb.connections, line 36, in defaulterrorhandler > OperationalError: (OperationalError) (2006, 'MySQL server has gone away') > 'call AuthUser(%s,%s)' (None, None) > > Okay, so that indicates to me that the AuthUser stored proc is what was > involved here, right? > > The problem is that, after I've done this, anything that uses a SQLAlchemy > connection in that app server dies with: > > Module sqlalchemy.orm.session, line 724, in execute > Module sqlalchemy.engine.base, line 1191, in execute > Module sqlalchemy.engine.base, line 1269, in _execute_clauseelement > Module sqlalchemy.engine.base, line 1377, in __create_execution_context > Module sqlalchemy.engine.default, line 392, in __init__ > Module sqlalchemy.engine.default, line 534, in create_cursor > Module sqlalchemy.engine.base, line 917, in connection > InvalidRequestError: Can't reconnect until invalid transaction is rolled back > > This is a brand new session from a new request, is this indicating that the > pooled connections are somehow being left in a weird state? > Any ideas why that would be?
SQLA won't raise that error unless the Connection were already invalidated, this is the SQLAlchemy wrapper for the connection which is roughly per-Session and not the DBAPI connection itself, so that Session/Connection definitely has an exception raise going on prior to that InvalidRequestError. You'd need to dig a little further to see where that's happening. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
