[Ironpython-users] IronPython, Daily Digest 1/24/2012

no_reply at codeplex.com no_reply at codeplex.com
Wed Jan 25 10:22:48 CET 2012


Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New issue] KeyError exception accessing threading.currentThread()

----------------------------------------------

ISSUES

1. [New issue] KeyError exception accessing threading.currentThread()
http://ironpython.codeplex.com/workitem/32125
User jamesholland has proposed the issue:

"I'm using the Task Parallel Library from IronPython along with the python logging module. Sometimes an exception is thrown by the logging module when calling one of the logging methods. The exception occurs when the __init__ method of LogRecord calls threading.currentThread().name.

The exception is a KeyError:

  File "C:\Program Files\IronPython\Lib\threading.py", line 828, in currentThread
    return _active[_get_ident()]
KeyError: 4

Taking a look at threading.py in the Python library that line of code is wrapped by try..except KeyError, and it should create a _DummyThread object in this circumstance. How can a KeyError be thrown and not caught by a handler designed to catch it?!?

I was able to reproduce this without the logging module, simply by firing up multiple tasks and having them call threading.currentThread().name. See attached file. You have to run it a number of times to see the error because it doesn't happen every time.

The end result is that the logging module appears not to be threadsafe when called from the TPL. If we channel all calls to the logging module through a Monitor the problem goes away. Is this behavior explainable? Is is supposed to be this way?"
----------------------------------------------



----------------------------------------------
You are receiving this email because you subscribed to notifications on CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20120125/0668fd51/attachment.html>


More information about the Ironpython-users mailing list