Bare "except" dangerous to ZODB? was Re: [Zope-dev] Accept-Charset hearders causing 500 internal server error.[correct but not lenient]

Shane Hathaway shane@zope.com
Mon, 10 Feb 2003 15:47:58 -0500


Paul Winkler wrote:
> On Mon, Feb 10, 2003 at 06:11:15PM -0200, Leonardo Rochael Almeida wrote:
> 
>>Please, please, please, don't use generic "except:". They can cause ZODB
>>corruption if they catch ConflictErrors.
> 
> 
> Can anyone else confirm or deny???
> If true, it needs to be much more widely publicized!

It's an open bug on Sourceforge:

http://sourceforge.net/tracker/index.php?func=detail&aid=637279&group_id=15628&atid=115628

> Great, so there's at least 133 things to examine to see if they
> could catch a ConflictError.  And I only wrote about 15 of those.
> The rest could be very time-consuming to audit.

"tal:on-error" also catches all exceptions.  It could be made to catch 
all exceptions except ConflictError, but I don't feel like that's the 
right solution.  I think the right solution is to prevent applications 
from committing potentially conflicting data, even when ConflictErrors 
are ignored.

This doesn't seem to be a showstopper for now, but as more applications 
use ZODB, it could become a bigger problem.

Shane