I have a problem with SQL Alchemy 0.8.1 on Python 2.7 running on linux box
via mod_wsgi. From time to time it produces the "InvalidRequestError: This
session is in 'prepared' state; no further SQL can be emitted within this
transaction". I use mod_wsgi with multiple processes of 1 thread per
process.
This error happens at random - it may take a few days to see it or it might
happen after a 5 minutes. I cannot understand what causes this and the
biggest problem - I don't understand what this error means. What is
'prepared' state? The documentation has no information on this state. From
what I saw it has some relation to two-way transactions but I do not use
them in my code. I use Session.query and Session.commit.
Any help would be appreciated.
Below is detailed stack trace of the error:
> ...
> File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line
> 2173, in one
> ret = list(self)
> self = <sqlalchemy.orm.query.Query object at 0x7f6f64348dd0>
>
> File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line
> 2216, in __iter__
> return self._execute_and_instances(context)
> self = <sqlalchemy.orm.query.Query object at 0x7f6f64348dd0>
> context = <sqlalchemy.orm.query.QueryContext object at
> 0x7f6f64348d50>
>
> File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line
> 2229, in _execute_and_instances
> close_with_result=True)
> querycontext = <sqlalchemy.orm.query.QueryContext object at
> 0x7f6f64348d50>
> self = <sqlalchemy.orm.query.Query object at 0x7f6f64348dd0>
>
> File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line
> 2220, in _connection_from_session
> **kw)
> self = <sqlalchemy.orm.query.Query object at 0x7f6f64348dd0>
> kw = {'clause': , 'close_with_result': True, 'mapper': }
>
> File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
> line 798, in connection
> close_with_result=close_with_result)
> mapper =
> clause = <sqlalchemy.sql.expression.Select at 0x7f6f64348d90;
> Select object>
> self = <sqlalchemy.orm.session.Session object at
> 0x7f6f68f6fe50>
> kw = {}
> bind =
> Engine(mysql+mysqldb://xxx:yyy@localhost/zzz?charset=utf8)
> close_with_result = True
>
> File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
> line 802, in _connection_for_bind
> return self.transaction._connection_for_bind(engine)
> engine =
> Engine(mysql+mysqldb://xxx:yyy@localhost/zzz?charset=utf8)
> self = <sqlalchemy.orm.session.Session object at
> 0x7f6f68f6fe50>
> kwargs = {'close_with_result': True}
>
> File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
> line 281, in _connection_for_bind
> self._assert_active()
> bind =
> Engine(mysql+mysqldb://xxx:yyy@localhost/zzz?charset=utf8)
> self = <sqlalchemy.orm.session.SessionTransaction object at
> 0x7f6f69be8050>
>
> File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
> line 181, in _assert_active
> "This session is in 'prepared' state; no further "
> rollback_ok = False
> prepared_ok = False
> closed_msg = 'This transaction is closed'
> self = <sqlalchemy.orm.session.SessionTransaction object at
> 0x7f6f69be8050>
>
> InvalidRequestError: This session is in 'prepared' state; no further SQL can
> be emitted within this transaction.
>
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.