[ZODB-Dev] Shared/DC/ZRDB/TM.py:_register

2008-05-13 Thread Vincent Pelletier
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 ?

-- 
Vincent Pelletier
___
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


Re: [ZODB-Dev] Shared/DC/ZRDB/TM.py:_register

2008-05-13 Thread Andreas Jung



--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 getthe error page to render. The most obvious breakage I could
see is whentrying to undo an non-undoable transaction (modify a
script twice, undo theoldest without undoing the newest)

Here is what happens:
 - first transaction (the undo in my example) raises in TPC,
transaction ismarked as failed
 - error message gets rendered in the same transaction (that's a
ZPublisherbug, 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
processtransaction's _adapters dict was modified. TM subclass
instance is notmarked as registered.
   Second try, now there is no exception raised, because transaction's
joinis not called (because of _adapters content). Now the TM
subclass instanceis marked as registered, but unknown to transaction
(_adapters will not beused 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

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


Re: [ZODB-Dev] Shared/DC/ZRDB/TM.py:_register

2008-05-13 Thread Andreas Jung



--On 13. Mai 2008 20:08:15 +0200 Dieter Maurer [EMAIL PROTECTED] wrote:


Andreas Jung wrote at 2008-5-13 10:44 +0200:

...

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?


Shared.DC.ZRDB.TM.TM is the standard Zope[2] way to implement a
ZODB DataManager.


Nowadays you create a datamanager implementing IDataManager and join it 
with the current transaction. Shared.DC.ZRDB.TM.TM is pretty much 
old-old-old-style.


Andreas

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


Re: [ZODB-Dev] Shared/DC/ZRDB/TM.py:_register

2008-05-13 Thread Dieter Maurer
Andreas Jung wrote at 2008-5-13 20:19 +0200:
 ...
 Shared.DC.ZRDB.TM.TM is the standard Zope[2] way to implement a
 ZODB DataManager.

Nowadays you create a datamanager implementing IDataManager and join it 
with the current transaction. Shared.DC.ZRDB.TM.TM is pretty much 
old-old-old-style.

Time to change the Zope 2 code base ;-)

There, you still find the old way -- and it is used by other Zope 2
components



-- 
Dieter
___
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


Re: [ZODB-Dev] ZODB 3.8.1b2 available and persistent caches

2008-05-13 Thread David Pratt
Hi Jim. Any chance of incorporating Shane's patch for relstorage for 
this release? Many thanks.


Regards,
David

Jim Fulton wrote:


Lately, we've started to use persistent caches. As we've done so, we've 
found and fixed a number of problems.  I'm planning to make a 3.8.1 
release soon.


Jim

--
Jim Fulton
Zope Corporation


___
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



___
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


Re: [ZODB-Dev] ZODB 3.8.1b2 available and persistent caches

2008-05-13 Thread Jim Fulton


On May 13, 2008, at 4:44 PM, David Pratt wrote:

Hi Jim. Any chance of incorporating Shane's patch for relstorage for  
this release? Many thanks.



No. This is a bug fix release.

Jim

--
Jim Fulton
Zope Corporation


___
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