[Ironpython-users] IronPython (ScriptEngine) is not thread safe?

Jeff Hardy jdhardy at gmail.com
Sun Mar 1 16:42:02 CET 2015


On Thu, Feb 26, 2015 at 9:39 AM, Jeffrey Zhao <jeffz at live.com> wrote:
>  Hi guys,
>
> I've met an issue when trying to use multiple ScriptEngine instances in
> parallel, since there's no information saying that a single ScriptEngine
> instance could be used concurrently. Please note "thread-safe" is not enough
> for me. What I need is the real parallelized execution in multiple threads,
> so I'm trying to use separated ScriptEngine instances in different threads.

In theory ScriptEngines should be independent and able to run in
parallel without issues. However, there might be interactions with
other parts that still have threading issues (this, BTW, is why
CPython uses a GIL - writing a free-threaded runtime correctly is
*hard*, and it's far to easy to bugs to slip in inadvertantly.)

It looks like this is that same as
https://github.com/IronLanguages/main/issues/1173 that was opened
recently with basically the same problem - there might be a race
condition in the weakref module. I'll try and track it down since
there's a couple of good small test cases to work from.

- Jeff


More information about the Ironpython-users mailing list