Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: "Error in sys.excepthook" message from Python 2.3multi-threadedscript

Reply
Thread Tools

RE: "Error in sys.excepthook" message from Python 2.3multi-threadedscript

 
 
Tim Peters
Guest
Posts: n/a
 
      10-30-2003
[Follower]
> I've run into an issue which seems to have been discussed previously
> on `python-dev` but only in context of Zope3:
>
> "Fun with 2.3 shutdown" -- Tim Peters
>
> <http://mail.python.org/pipermail/python-dev/2003-September/038151.html>
>
> The following message is displayed (one or more times) when exiting
> (in this case via a `KeyboardInterrupt` exception) a multi-threaded
> Python 2.3 script (on Mac OS X 10.2.1):
>
> """
> Unhandled exception in thread started by
> Error in sys.excepthook:
>
> Original exception was:
> """
>
> It doesn't always happen consistently. As a comparison, I have run the
> same script under Python 2.2.2 and the problem does not seem to occur
> there. (Although, of course, with threads that's no guarantee...)


As explained in the referenced thread, 2.3 is more aggressive about giving
cyclic trash a chance to clean itself up at Python shutdown time, and in
particular calls the cyclic garbage collector after the fundamental sys
module has been mostly destroyed. Cycles that are broken can allow objects
with __del__ methods to get themselves run, and once we're in a Python-level
__del__ method any number of threads can end up running. They can end up
referencing other objects that have been destroyed, thus raising exceptions.
The messages Python then wants to print about exceptions in threads can't be
displayed because too much of sys is missing at that time (e.g., sys.stderr
is gone, and so is sys.excepthook), so we get those ridiculous-looking
information-free messages.

> I had a look at the bug list on Sourceforge and this issue doesn't
> seem to have made it there yet, so I thought I'd raise it here, partly
> as Google-bait and partly to see if I should re-raise the issue on
> `python-dev`.


I know I didn't enter an SF bug. We solved the problem in Zope3 by fixing
bugs in its tests (several tests were being bad citizens, leaving immortal
daemon threads behind; changing the tests to shut down their threads made
the Python shutdown irritations go away). You shouldn't re-raise it on
python-dev unless you want to suggest a specific solution; a bug report
would be appropriate.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thunderbird - message exceeds the Maximum Message Size? Gerry Firefox 0 02-18-2005 06:39 PM
New OWA message and Modify body of Message - Steve - ASP .Net 0 07-06-2004 04:54 AM
[python] Figured out how to go from email.Message.Message to string David Stockwell Python 1 06-17-2004 08:52 PM
Size of e-mail message - message.Body = msgText =?Utf-8?B?bWc=?= ASP .Net 1 02-11-2004 07:42 PM
Combining message.BodyFormat = MailFormat.Html & message.BodyFormat = MailFormat.Text =?Utf-8?B?bWc=?= ASP .Net 1 02-08-2004 10:43 PM



Advertisments