How to except the unexpected?

Rene Pijlman reply.in.the.newsgroup at my.address.is.invalid
Sun Mar 5 08:52:37 EST 2006


Steven D'Aprano:
>The OP is doing it because catching all exceptions masks bugs. There are
>certain exceptions which should be allowed through, as they indicate a bug
>in the OP's code. Normally the tactic is to catch only the exceptions you
>are interested in, and let everything else through, but the OP needs to
>catch all exceptions because there are rare exceptions which he can't
>predict in advance.

To add to that explanation: this is in a multithreaded ZODB-application.
When an unexpected exception occurs and remains uncaught, a thread
terminates, causing the thread pool to wait forever since some thread is
not consuming its termination request from the queue, causing the app to
not terminate, causing the ZODB to remain locked, causing other apps to
fail, causing havoc on my server.

I don't mind this when it's caused by a bug in my code, since that creates
the sense of urgency required to fix the bug. But it's annoying when it
happens because of an I/O exception caused by some other guys bug on the
other side of the planet :-)

-- 
René Pijlman



More information about the Python-list mailing list