Discussion:
[TurboGears] Admin controller issue with ZTE
D R Dinesh Kumar
2017-05-11 17:30:44 UTC
Permalink
Hi All,

I am using the following statement to create DB session

maker = sessionmaker(autoflush=True, autocommit=False,
extension=ZopeTransactionExtension())
DBSession = scoped_session(maker)

and in my app, I have created model view admin controllers for user,group
etc.
when I try to edit users, I am hitting the following issue.

File
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/transaction/_transaction.py",
line 423, in _commitResources
rm.tpc_vote(self)
File
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/zope/sqlalchemy/datamanager.py",
line 109, in tpc_vote
self.tx.commit()
File
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
line 459, in commit
self._assert_active(prepared_ok=True)
File
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
line 285, in _assert_active
raise sa_exc.ResourceClosedError(closed_msg)
ResourceClosedError: This transaction is closed

Any help is greatly appreciated.!!

Possible issue:: Since ZTE is used, calling .commit() explicitly is not
required.

is there a way to handle this to create different session (without ZTE) for
AdminController to use?

With Regards,
Dinesh.
--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.
Alessandro Molina
2017-05-12 07:28:17 UTC
Permalink
There should be something else in your code causing the transaction to be
completed before the transaction manager tries to commit it.
Do your models have any even listener or something else that might be
trying to commit changes before the end of the request? In TG2 unless the
transaction manager is disabled you should never commit or rollback the
transaction yourself, you let it go or you doom it.
Post by D R Dinesh Kumar
Hi All,
I am using the following statement to create DB session
maker = sessionmaker(autoflush=True, autocommit=False,
extension=ZopeTransactionExtension())
DBSession = scoped_session(maker)
and in my app, I have created model view admin controllers for user,group
etc.
when I try to edit users, I am hitting the following issue.
File "/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/
site-packages/transaction/_transaction.py", line 423, in _commitResources
rm.tpc_vote(self)
File "/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/
site-packages/zope/sqlalchemy/datamanager.py", line 109, in tpc_vote
self.tx.commit()
File "/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/
site-packages/sqlalchemy/orm/session.py", line 459, in commit
self._assert_active(prepared_ok=True)
File "/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/
site-packages/sqlalchemy/orm/session.py", line 285, in _assert_active
raise sa_exc.ResourceClosedError(closed_msg)
ResourceClosedError: This transaction is closed
Any help is greatly appreciated.!!
Possible issue:: Since ZTE is used, calling .commit() explicitly is not
required.
is there a way to handle this to create different session (without ZTE)
for AdminController to use?
With Regards,
Dinesh.
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.
D R Dinesh Kumar
2017-05-19 08:59:01 UTC
Permalink
Hi Alessandro,

I have set use_transaction_manager=1 so I let tg handle all transactions.
I have tried using different DBSession for AdminController which resolved
this issue.
Later on, I have reverted the changes and DB restart happened (due to some
other reason), surprisingly I didnt see this issue after that. Will test
this again after some time!!
Thanks.

With Regards,
Dinesh.
Post by D R Dinesh Kumar
Hi All,
I am using the following statement to create DB session
maker = sessionmaker(autoflush=True, autocommit=False,
extension=ZopeTransactionExtension())
DBSession = scoped_session(maker)
and in my app, I have created model view admin controllers for user,group
etc.
when I try to edit users, I am hitting the following issue.
File
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/transaction/_transaction.py",
line 423, in _commitResources
rm.tpc_vote(self)
File
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/zope/sqlalchemy/datamanager.py",
line 109, in tpc_vote
self.tx.commit()
File
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
line 459, in commit
self._assert_active(prepared_ok=True)
File
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
line 285, in _assert_active
raise sa_exc.ResourceClosedError(closed_msg)
ResourceClosedError: This transaction is closed
Any help is greatly appreciated.!!
Possible issue:: Since ZTE is used, calling .commit() explicitly is not
required.
is there a way to handle this to create different session (without ZTE)
for AdminController to use?
With Regards,
Dinesh.
--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.
Loading...