--On 13. Mai 2008 10:36:48 +0200 Vincent Pelletier <[EMAIL PROTECTED]> wrote:

Hi.

_register method of TM class in Shared/DC/ZRDB/TM.py hides all exceptions.

This makes descendants of this class prone to get stuck in a "registered"
state withtout any possibility of them to get commited.

To reproduce the problem:
 - create a class inheriting from TM, and define a method calling
register.    Add logs to abort and commit method to track transaction end.
 - create a default error page which triggers a call to the method created
   above. (this is equivalent to accessing some database from the error
page,    for example)
   Call it twice.
   Most realistic case is using an instance surviving the transaction (a
   global, or a persistant object)
 - tigger an error in TPC (a raise in vote is the most realistic case)
and get    the error page to render. The most obvious breakage I could
see is when    trying to undo an non-undoable transaction (modify a
script twice, undo the    oldest without undoing the newest)

Here is what happens:
 - first transaction (the "undo" in my example) raises in TPC,
transaction is    marked as failed
 - error message gets rendered in the same transaction (that's a
ZPublisher    bug, but I think the problem "root" is hiding the failure)
 - error message tries to register itself to transaction manager:
   First try gets an exception (hidden in TM._register), but in the
process    transaction's "_adapters" dict was modified. TM subclass
instance is not    marked as registered.
   Second try, now there is no exception raised, because transaction's
"join"    is not called (because of _adapters content). Now the TM
subclass instance    is marked as registered, but unknown to transaction
(_adapters will not be    used to commit).

The variant with just one call to TM._register "only" causes the instance
to  be commited at next transaction using it.

Is there any reason why TM._register is hiding exceptions ?

Isn't the right approach for integrating a module with ZODB transactions using a ZODB DataManager?

Andreas

Attachment: pgpBTR1J9YUMG.pgp
Description: PGP signature

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to