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.
_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to