[Ironpython-users] IronPython, Daily Digest 12/12/2011

no_reply at codeplex.com no_reply at codeplex.com
Tue Dec 13 14:11:25 CET 2011


Hi ironpython,

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

In today's digest:ISSUES

1. [New issue] IP 2.7.1 xml.etree.Elementree#iterparse is not working
2. [New issue] Why is calling a Python lambda expression from C# not thread-safe?
3. [New issue] Why is calling a Python lambda expression from C# not thread-safe?
4. [New comment] Why is calling a Python lambda expression from C# not thread-safe?
5. [New comment] IPy version string somewhat misleading.

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

ISSUES

1. [New issue] IP 2.7.1 xml.etree.Elementree#iterparse is not working
http://ironpython.codeplex.com/workitem/31923
User mkorpela has proposed the issue:

"from StringIO import StringIO as S
from xml.etree import ElementTree as ET
ET.iterparse(S('<test/>'))
-->
AttributeError: TreeBuilder instance has no attribute '_parser'

Seems that SimpleXMLTreeBuilder.TreeBuilder or xmllib.XMLParser should have this for iterparser to work (or the sys.platform == 'cli' part should be changed in ElementTree.py).

Anyway completely makes it impossible to use iterparse in xml.etree with ironpython."-----------------

2. [New issue] Why is calling a Python lambda expression from C# not thread-safe?
http://ironpython.codeplex.com/workitem/31924
User Rauhotz has proposed the issue:

"I define a side-effect-free (pure) lambda expression in IronPython and assign it to a C# delegate. When invoking the delegate simultaneously from multiple threads i get exceptions of type **AccessViolationException**, **NullReferenceException** and **FatalEngineExecutionError**.

The occurance of the error is non-deterministic and it mostly takes several million iterations to provoke it, which says "race condition" to me. How can i avoid it?

The exceptions are only raised when running the process with x64 (x86 does not crash) and outside of the debugger. The test system is a Core I7 (8 threads) on Windows 7, .NET Framework 4.0 and IronPython 2.7.1.

Here's the minimal code to produce the error:

    var engine = Python.CreateEngine();

    double a = 1.0;
    double b = 2.0;

    while (true)
    {
        Func<double, double, double> calculate = engine.Execute("lambda a,b : a+b");

        System.Threading.Tasks.Parallel.For(0, 1000, _ =>
        {
             for (int i = 0; i < 1000; i++) { calculate(a,b); }
        });
        
        Console.Write(".");   
    }

Error message:

>FatalExecutionEngineError was detected
>
>Message: The runtime has encountered a fatal error. The address of the error was at 0xf807829e, on thread 0x3da0. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Even if the engine is declared as thread-local, it crashes after some time:

    var calculate = new ThreadLocal<Func<double, double, double>>(() => Python.CreateEngine().Execute("lambda a,b : a+b"));"-----------------

3. [New issue] Why is calling a Python lambda expression from C# not thread-safe?
http://ironpython.codeplex.com/workitem/31925
User Rauhotz has proposed the issue:

"I define a side-effect-free (pure) lambda expression in IronPython and assign it to a C# delegate. When invoking the delegate simultaneously from multiple threads i get exceptions of type **AccessViolationException**, **NullReferenceException** and **FatalEngineExecutionError**.

The occurance of the error is non-deterministic and it mostly takes several million iterations to provoke it, which says "race condition" to me. How can i avoid it?

The exceptions are only raised when running the process with x64 (x86 does not crash) and outside of the debugger. The test system is a Core I7 (8 threads) on Windows 7, .NET Framework 4.0 and IronPython 2.7.1.

Here's the minimal code to produce the error:

    var engine = Python.CreateEngine();

    double a = 1.0;
    double b = 2.0;

    while (true)
    {
        Func<double, double, double> calculate = engine.Execute("lambda a,b : a+b");

        System.Threading.Tasks.Parallel.For(0, 1000, _ =>
        {
             for (int i = 0; i < 1000; i++) { calculate(a,b); }
        });
        
        Console.Write(".");   
    }

Error message:

>FatalExecutionEngineError was detected
>
>Message: The runtime has encountered a fatal error. The address of the error was at 0xf807829e, on thread 0x3da0. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Even if the engine is declared as thread-local, it crashes after some time:

    var calculate = new ThreadLocal<Func<double, double, double>>(() => Python.CreateEngine().Execute("lambda a,b : a+b"));"-----------------

4. [New comment] Why is calling a Python lambda expression from C# not thread-safe?
http://ironpython.codeplex.com/workitem/31925
User Rauhotz has commented on the issue:

"Sorry, pressing the "Save" button had no effect, so i pressed it again. Now there's a double post."-----------------

5. [New comment] IPy version string somewhat misleading.
http://ironpython.codeplex.com/workitem/31420
User jdhardy has commented on the issue:

"I'm going to be making changes to the version string (there was another bug about it recently), and I do want to add more information without turning it into a browser User-Agent string."
----------------------------------------------



----------------------------------------------
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/20111213/8a9ca471/attachment.html>


More information about the Ironpython-users mailing list