Thanks Mike for your quick response.

I removed the zope.sqlalchemy extension and I am no longer getting the
zope error.

Since we are using a scoped_session, we don't think it's a threading
issue although we are running in a multi-threaded env.

I am trying to create this exception to occur in my test env.

What state do we have to leave the Session object in - inorder to
generate an 'InvalidRequestError' exception.
Again, assuming that it is not a multithreaded concurrency issue given
I am using sessions produced from ScopedSession.

My assumption is that since I am using ScopedSession, each thread gets
it's own session object and session objects are not shared among
threads.

Again appreciate your help with this.

thanks!

Ajay




On Mar 12, 11:38 am, Michael Bayer <mike...@zzzcomputing.com> wrote:
> On Mar 11, 2011, at 7:51 PM, AJAY PATTNI wrote:
>
>
>
> > We use sqlalchemy 0.4.6 with Elixir 0.5.2 and zope.sqlalchemy
>
> > Every once a while we get this error(see below):
> > In a previous thread somebody said, just 'rollback your session when
> > the exception is raised'?
>
> > We use a global session as follows:
>
> > __session__ =
> > scoped_session(sessionmaker(twophase=False,transactional=True,autoflush=True,extension=ZopeTransactionExtension()))
>
> > All the rest of the transactional machinery is handled by Elixiry
> > Entity object.
>
> > So my question - how can we rollback in this situation?
>
> > We tried to do __session__.remove() which seems to work but then zope
> > seems to have a problem after it completes the request.
>
> A description of what this error means from the perspective of SQLAlchemy 
> only, not that of zope.sqlalchemy for which you should consult their mailing 
> list, is here:
>
>        
> http://www.sqlalchemy.org/trac/wiki/FAQ#Thetransactionisinactivedueto...
>
> However, note that version 0.4.6 of SQLAlchemy is extremely old, and the 
> mechanics of session and transaction have been largely reworked since then.   
> The basic idea that a rollback needs to occur is consistent in that version, 
> however.
>
> Its very likely that some artifact of zope.sqlalchemy is involved in the 
> production of your error here.
>
> > ======================
> > 2011-03-11T10:41:22 ERROR Zope.SiteErrorLog
> >http://dragon.initiatesystems.com:8080/ati/txm_inject_orm
> > Traceback (innermost last):
> >  Module ZPublisher.Publish, line 121, in publish
> >  Module Zope2.App.startup, line 238, in commit
> >  Module transaction._manager, line 89, in commit
> >  Module transaction._transaction, line 329, in commit
> >  Module transaction._transaction, line 446, in _commitResources
> >  Module zope.sqlalchemy.datamanager, line 76, in tpc_vote
> >  Module sqlalchemy.orm.session, line 263, in commit
> >  Module sqlalchemy.orm.session, line 176, in _assert_is_open
> > InvalidRequestError: The transaction is closed
> > =====================
>
> > Appreciate any help I can get on this.
>
> > ================
> > Mar 4 12:56:23 pbrk4.den05.accenx.com [err]
> >https://acm.accenx.com/mapsrvcluster/ati/acm/tdm/group/19150/broker/2...
> > (innermost last):#012 Module ZPublisher.Publish, line 115, in
> > publish#012 Module ZPublisher.mapply, line 88, in mapply#012 Module
> > ZPublisher.Publish, line 41, in call_object#012 Module
> > Shared.DC.Scripts.Bindings, line 313, in __call__#012 Module
> > Shared.DC.Scripts.Bindings, line 350, in _bindAndExec#012 Module
> > Products.PythonScripts.PythonScript, line 326, in _exec#012 Module
> > None, line 90, in processMsg#012 - <PythonScript at /ati/acm/tdm/group/
> > processMsg used for /ati/acm/tdm/group/19150/broker/25150/site/
> > 705077435>#012 - Line 90#012 Module Shared.DC.Scripts.Bindings, line
> > 313, in __call__#012 Module Shared.DC.Scripts.Bindings, line 350, in
> > _bindAndExec#012 Module Products.PythonScripts.PythonScript, line 326,
> > in _exec#012 Module None, line 131, in translate#012 - <PythonScript
> > at /ati/acm/tdm/group/19150/broker/25150/site/705077435/outbound/
> > translate>#012 - Line 131#012 Module Shared.DC.Scripts.Bindings, line
> > 313, in __call__#012 Module Shared.DC.Scripts.Bindings, line 350, in
> > _bindAndExec#012 Module Products.PythonScripts.PythonScript, line 326,
> > in _exec#012 Module None, line 99, in callTxm#012 - <PythonScript at /
> > ati/acm/tdm/group/19150/broker/25150/site/705077435/outbound/
> > callTxm>#012 - Line 99#012 Module Shared.DC.Scripts.Bindings, line
> > 313, in __call__#012 Module Shared.DC.Scripts.Bindings, line 350, in
> > _bindAndExec#012 Module Products.PythonScripts.PythonScript, line 326,
> > in _exec#012 Module None, line 44, in txm_ampiWrapperOrm#012 -
> > <PythonScript at /ati/acm/tdm/group/19150/broker/25150/
> > BrokerMapFunctions/TxmFunctions/txm_ampiWrapperOrm>#012 - Line 44#012
> > Module Shared.DC.Scripts.Bindings, line 313, in __call__#012 Module
> > Shared.DC.Scripts.Bindings, line 350, in _bindAndExec#012 Module
> > Products.PythonScripts.PythonScript, line 326, in _exec#012 Module
> > None, line 22, in getTransactionTypes#012 - <PythonScript at /ati/acm/
> > tdm/group/19150/broker/25150/BrokerMapFunctions/TxmFunctions/
> > getTransactionTypes>#012 - Line 22#012 Module Products.txm.txm, line
> > 537, in txmQuery#012 Module Products.txm.txm_functions, line 139, in
> > __init__#012 Module elixir.entity, line 854, in get_by#012 Module
> > sqlalchemy.orm.query, line 907, in first#012 Module
> > sqlalchemy.orm.query, line 935, in __iter__#012 Module
> > sqlalchemy.orm.session, line 768, in _autoflush#012 Module
> > sqlalchemy.orm.session, line 786, in flush#012 Module
> > sqlalchemy.orm.unitofwork, line 230, in flush#012 Module
> > sqlalchemy.orm.session, line 499, in begin#012 Module
> > sqlalchemy.orm.session, line 178, in _begin#012 Module
> > sqlalchemy.orm.session, line 166, in
> > _assert_is_active#012InvalidRequestError: The transaction is inactive
> > due to a rollback in a subtransaction and should be closed
> > =========
>
> > --
> > 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 
> > athttp://groups.google.com/group/sqlalchemy?hl=en.

-- 
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.

Reply via email to