Hello group,
I am working on a project using TG1.0.4b3, SQL Alchemy
0.4.3 and python2.5, where i have two process doing insert and delete
operation on the same row of a table at some given time. delete
operation is a UI event. and insert is being done by a background
process. now if a user hits delete while the background process was
doing insert. the web shows an SQL Alchemy Invalid Request error.
Message that it gives is "The transaction is invalid due to a rollback
in sub-transaction".
Help is urgently required.
here's the tracback --->
Error
An Error has occured. The Error has been recorded in the log file.
Please contact support with the logs and all other relevant
information.
Click to see the traceback
________________________________________
--> -->
<class 'sqlalchemy.exceptions.InvalidRequestError'> Python 2.5.2: C:
\python25\python.exe
Tue May 20 10:05:59 2008
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
c:\python25\lib\site-packages\cherrypy-2.2.1-py2.5.egg\cherrypy
\_cphttptools.py in _run(self=<cherrypy._cphttptools.Request object at
0x037F5D10>)
103 applyFilters('before_main')
104 if self.execute_main:
105 self.main()
106 break
107 except cherrypy.InternalRedirect, ir:
self = <cherrypy._cphttptools.Request object at 0x037F5D10>, self.main
= <bound method Request.main of <cherrypy._cphttptools.Request object
at 0x037F5D10>>
c:\python25\lib\site-packages\cherrypy-2.2.1-py2.5.egg\cherrypy
\_cphttptools.py in main(self=<cherrypy._cphttptools.Request object at
0x037F5D10>, path='/admin/deletestudy')
252 self.object_path = '/' + '/'.join(object_path[1:])
253 try:
254 body = page_handler(*virtual_path, **self.params)
255 except Exception, x:
256 if hasattr(x, "args"):
body undefined, page_handler = <bound method Admin.deletestudy of
<radspeed.controllers.Admin instance at 0x0310AC38>>, virtual_path =
[], self = <cherrypy._cphttptools.Request object at 0x037F5D10>,
self.params = {'studylist':
u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,', 'studylist2': u''}
D:\svn\main\projects\RadSpeed\web\radspeed-TG1.0\<string> in
deletestudy(self=<radspeed.controllers.Admin instance at 0x0310AC38>,
studylist=u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,',
*args=(), **kargs={'studylist2': u''})
c:\python25\lib\site-packages\TurboGears-1.0.4b3-py2.5.egg\turbogears
\controllers.py in expose(func=<function deletestudy at 0x030FD530>,
*args=(<radspeed.controllers.Admin instance at 0x0310AC38>,),
**kw={'studylist': u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,',
'studylist2': u''})
342 output = database.run_with_transaction(
343 func._expose, func, accept,
func._allow_json,
344 *args, **kw)
345 return output
346 func.exposed = True
args = (<radspeed.controllers.Admin instance at 0x0310AC38>,), kw =
{'studylist': u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,',
'studylist2': u''}
D:\svn\main\projects\RadSpeed\web\radspeed-TG1.0\<string> in
run_with_transaction(func=<function _expose at 0x0354C030>,
*args=(<function deletestudy at 0x030FD530>, 'image/gif, image/x-
xbitmap, image/jpeg, image/pj...pplication/msword, application/x-
silverlight, */*', True, <radspeed.controllers.Admin instance at
0x0310AC38>), **kw={'studylist':
u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,', 'studylist2':
u''})
C:\python25\lib\site-packages\turbogears-1.0.4b3-py2.5.egg\turbogears
\database.py in sa_rwt(func=<function _expose at 0x0354C030>,
*args=(<function deletestudy at 0x030FD530>, 'image/gif, image/x-
xbitmap, image/jpeg, image/pj...pplication/msword, application/x-
silverlight, */*', True, <radspeed.controllers.Admin instance at
0x0310AC38>), **kw={'studylist':
u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,', 'studylist2':
u''})
404
405 try:
406 retval = func(*args, **kw)
407
408 except (cherrypy.HTTPRedirect, cherrypy.InternalRedirect):
retval undefined, func = <function _expose at 0x0354C030>, args =
(<function deletestudy at 0x030FD530>, 'image/gif, image/x-xbitmap,
image/jpeg, image/pj...pplication/msword, application/x-silverlight, */
*', True, <radspeed.controllers.Admin instance at 0x0310AC38>), kw =
{'studylist': u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,',
'studylist2': u''}
D:\svn\main\projects\RadSpeed\web\radspeed-TG1.0\<string> in
_expose(func=<function deletestudy at 0x030FD530>, accept='image/gif,
image/x-xbitmap, image/jpeg, image/pj...pplication/msword, application/
x-silverlight, */*', allow_json=True,
*args=(<radspeed.controllers.Admin instance at 0x0310AC38>,),
**kw={'studylist': u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,',
'studylist2': u''})
c:\python25\lib\site-packages\TurboGears-1.0.4b3-py2.5.egg\turbogears
\controllers.py in (_func=<function deletestudy at 0x030FD530>,
accept='image/gif, image/x-xbitmap, image/jpeg, image/pj...pplication/
msword, application/x-silverlight, */*', allow_json=True,
*args=(<radspeed.controllers.Admin instance at 0x0310AC38>,),
**kw={'studylist2': u''})
357 *args, **kw:
358 _execute_func(_func, template, format,
content_type,
359 mapping, fragment, args, kw)))
360
361 if allow_json:
mapping = None, fragment = False, args = (<radspeed.controllers.Admin
instance at 0x0310AC38>,), kw = {'studylist2': u''}
c:\python25\lib\site-packages\TurboGears-1.0.4b3-py2.5.egg\turbogears
\controllers.py in _execute_func(func=<function deletestudy at
0x030FD530>, template='json', format=None, content_type=None,
mapping=None, fragment=False, args=(<radspeed.controllers.Admin
instance at 0x0310AC38>,
u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,'), kw={'studylist2':
u''})
384 # this means big memory usage, and we don't want that in
production
385 log.debug("Calling %s with *(%s), **(%s)", func, args,
kw)
386 output = errorhandling.try_call(func, *args, **kw)
387 if isinstance(output, list):
388 return output
output undefined, global errorhandling = <module
'turbogears.errorhandling' from 'C:\pyth...-1.0.4b3-py2.5.egg
\turbogears\errorhandling.pyc'>, errorhandling.try_call = <function
try_call at 0x02CEEAB0>, func = <function deletestudy at 0x030FD530>,
args = (<radspeed.controllers.Admin instance at 0x0310AC38>,
u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,'), kw =
{'studylist2': u''}
c:\python25\lib\site-packages\TurboGears-1.0.4b3-py2.5.egg\turbogears
\errorhandling.py in try_call(func=<function deletestudy at
0x030FD530>, self=<radspeed.controllers.Admin instance at 0x0310AC38>,
*args=(u'1.3.12.2.1107.5.1.4.51964.4.0.3778684930241122,',),
**kw={'studylist2': u''})
81 remove_keys(kw, ("tg_source", "tg_errors",
"tg_exceptions"))
82 if getattr(cherrypy.request, "in_transaction",
None):
83 restart_transaction(1)
84 try:
85 output = dispatch_error(self, func, None, e,
*args, **kw)
restart_transaction = <function restart_transaction at 0x02CE7FB0>
D:\svn\main\projects\RadSpeed\web\radspeed-TG1.0\<string> in
restart_transaction(args=1)
C:\python25\lib\site-packages\turbogears-1.0.4b3-py2.5.egg\turbogears
\database.py in sa_restart_transaction(args=1)
436 req.sa_transaction.rollback()
437 session.clear()
438 req.sa_transaction = make_sa_transaction(session)
439
440 def sa_tr_active(tr):
req = <cherrypy._cphttptools.Request object at 0x037F5D10>,
req.sa_transaction = <sqlalchemy.orm.scoping.ScopedSession object at
0x02CE6CB0>, global make_sa_transaction = <function
make_sa_transaction at 0x02CEE4F0>, global session =
<sqlalchemy.orm.scoping.ScopedSession object at 0x02CE6CB0>
C:\python25\lib\site-packages\turbogears-1.0.4b3-py2.5.egg\turbogears
\database.py in
make_sa_transaction(session=<sqlalchemy.orm.scoping.ScopedSession
object at 0x02CE6CB0>)
454 else:
455 # SA 0.4
456 session.begin()
457 return session
458
session = <sqlalchemy.orm.scoping.ScopedSession object at 0x02CE6CB0>,
session.begin = <bound method ScopedSession.do of
<sqlalchemy.orm.scoping.ScopedSession object at 0x02CE6CB0>>
c:\python25\lib\site-packages\SQLAlchemy-0.4.4-py2.5.egg\sqlalchemy
\orm\scoping.py in do(self=<sqlalchemy.orm.scoping.ScopedSession
object at 0x02CE6CB0>, *args=(), **kwargs={})
96 def instrument(name):
97 def do(self, *args, **kwargs):
98 return getattr(self.registry(), name)(*args, **kwargs)
99 return do
100 for meth in ('get', 'load', 'close', 'save', 'commit', 'update',
'save_or_update', 'flush', 'query', 'delete', 'merge', 'clear',
'refresh', 'expire', 'expunge', 'rollback', 'begin', 'begin_nested',
'connection', 'execute', 'scalar', 'get_bind', 'is_modified',
'__contains__', '__iter__'):
builtin getattr = <built-in function getattr>, self =
<sqlalchemy.orm.scoping.ScopedSession object at 0x02CE6CB0>,
self.registry = <sqlalchemy.util.ScopedRegistry object at 0x02CE6CD0>,
name = 'begin', args = (), kwargs = {}
c:\python25\lib\site-packages\SQLAlchemy-0.4.4-py2.5.egg\sqlalchemy
\orm\session.py in begin(self=<sqlalchemy.orm.session.Session object
at 0x03521B10>, **kwargs={})
487
488 if self.transaction is not None:
489 self.transaction = self.transaction._begin(**kwargs)
490 else:
491 self.transaction = SessionTransaction(self,
**kwargs)
self = <sqlalchemy.orm.session.Session object at 0x03521B10>,
self.transaction = None, self.transaction._begin undefined, kwargs =
{}
c:\python25\lib\site-packages\SQLAlchemy-0.4.4-py2.5.egg\sqlalchemy
\orm\session.py in
_begin(self=<sqlalchemy.orm.session.SessionTransaction object at
0x03A7B530>, **kwargs={})
169
170 def _begin(self, **kwargs):
171 self._assert_is_active()
172 return SessionTransaction(self.session, self, **kwargs)
173
self = <sqlalchemy.orm.session.SessionTransaction object at
0x03A7B530>, self._assert_is_active = <bound method
SessionTransaction._assert_is_acti...session.SessionTransaction object
at 0x03A7B530>>
c:\python25\lib\site-packages\SQLAlchemy-0.4.4-py2.5.egg\sqlalchemy
\orm\session.py in
_assert_is_active(self=<sqlalchemy.orm.session.SessionTransaction
object at 0x03A7B530>)
157 self._assert_is_open()
158 if not self._active:
159 raise exceptions.InvalidRequestError("The
transaction is inactive due to a rollback in a subtransaction and
should be closed")
160
161 def _assert_is_open(self):
global exceptions = <module 'sqlalchemy.exceptions' from 'C:
\python2...chemy-0.4.4-py2.5.egg\sqlalchemy\exceptions.pyc'>,
exceptions.InvalidRequestError = <class
'sqlalchemy.exceptions.InvalidRequestError'>
<class 'sqlalchemy.exceptions.InvalidRequestError'>: ('The transaction
is inactive due to a rollback in a subtransaction and should be
closed', <bound method Admin.deletestudy of
<radspeed.controllers.Admin instance at 0x0310AC38>>)
args = ('The transaction is inactive due to a rollback in a
subtransaction and should be closed', <bound method Admin.deletestudy
of <radspeed.controllers.Admin instance at 0x0310AC38>>)
message = 'The transaction is inactive due to a rollback in a
subtransaction and should be closed'
Thanks
Abhishek
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---