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

Paul Winkler pw_lists@slinkp.com
Mon, 10 Feb 2003 12:30:32 -0800


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!

$ cd /usr/src/Zope-2.6.1-src/lib/python/Products/
$ find . -name "*py" -exec grep -H "except:" {} \; | wc -l
    170

well, this is all stuff that comes with Zope, hopefully
they have been vetted... but then there's all these
3rd-party products:

$ cd $INSTANCE_HOME/Products
$ find . -name "*py" -exec grep -H "except:" {} \; | wc -l
    133


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.

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's THE GOBLET!
(random hero from isometric.spaceninja.com)