Actually, I found that the error goes away if I don't set pool_recycle=True. However, I'm told pool_recycle is necessary to prevent "MySQL has gone away" errors. My guess then is that SQLAclehmy preparing a statement, it works right the first time, and thereafter there is an issue with it.
So you're right, it is deterministic. Ideas on how to address it though? On Dec 16, 5:02 pm, Michael Bayer <mike...@zzzcomputing.com> wrote: > ive never seen that error before. threading issues are usually not > very deterministic either (happens on the 2nd request guaranteed is > deterministic). > > On Dec 16, 2008, at 1:09 PM, Ken wrote: > > > > > I'm using CherryPy with SQLAlchemy. I've tried this with both > > SQLAlchemy's scoped_session thread-local sessions, as well as (also > > local-to-thread) sessions I create in my web code manually. > > > 2008-12-16 11:51:14,524 DEBUG cherrypy.error.140068141119376: [16/Dec/ > > 2008:11:51:14] HTTP Traceback (most recent call last): > > File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py", > > line 1027, in first > > ret = list(self[0:1]) > > File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py", > > line 952, in __getitem__ > > return list(res) > > File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py", > > line 1088, in __iter__ > > return self._execute_and_instances(context) > > File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py", > > line 1091, in _execute_and_instances > > result = self.session.execute(querycontext.statement, > > params=self._params, mapper=self._mapper_zero_or_none(), > > _state=self._refresh_state) > > File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/session.py", > > line 749, in execute > > return self.__connection(engine, close_with_result=True).execute( > > File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", > > line 806, in execute > > return Connection.executors[c](self, object, multiparams, params) > > File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", > > line 856, in execute_clauseelement > > return self.__execute_context(context) > > File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", > > line 878, in __execute_context > > self._cursor_execute(context.cursor, context.statement, > > context.parameters[0], context=context) > > File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", > > line 927, in _cursor_execute > > self._handle_dbapi_exception(e, statement, parameters, cursor) > > File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py", > > line 909, in _handle_dbapi_exception > > raise exc.DBAPIError.instance(statement, parameters, e, > > connection_invalidated=is_disconnect) > > InterfaceError: (InterfaceError) (0, '') u'SELECT login.username AS > > login_username, login.password AS login_password, login.`loginId` AS > > `login_loginId`, login.salt AS login_salt, login.email AS login_email, > > login.status AS login_status, login.message AS login_message, > > login.`accountId` AS `login_accountId` \nFROM login \nWHERE > > login.`loginId` = %s \n LIMIT 0, 1' [36L] > > > The first time this query runs, it works fine. Thereafter I get this > > error message. Any ideas? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@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 -~----------~----~----~----~------~----~------~--~---