[IronPython] import thread-safety

Kamil Dworakowski kamil at dworakowski.name
Tue Mar 10 19:07:34 CET 2009


Hello,

I tried reactivate parallel importing in Resolver One. More info in
this thread from October:
http://groups.google.com/group/ironpy/browse_thread/thread/11c5c917d716b7cc/58ce4e4260c2773a?lnk=gst&q=parallel+import#58ce4e4260c2773a

I hit a problem. Sometimes during importing I get the following
exception. It is a bit of a haisenbug because whenever I try to add
some diagnostics Resolver One starts fine.

CLS Exception: System.InvalidOperationException: Collection was
modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException
(ExceptionResource resource)
   at
System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext
()
   at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod
(MethodInfo mi, String newName)
   at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type
finishedType, Dictionary`2 specialNames)
   at IronPython.Runtime.Types.NewTypeMaker.CreateNewType()
   at
IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.<GetNewType>b__0
()
   at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key,
Func`1 create)
   at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String
typeName, PythonTuple bases, IAttributesCollection dict)
   at IronPython.Runtime.Types.PythonType..ctor(CodeContext context,
String name, PythonTuple bases, IAttributesCollection dict)
   at IronPython.Runtime.Types.PythonType.__new__(CodeContext context,
PythonType cls, String name, PythonTuple bases, IAttributesCollection
dict)
   at _stub_$270##128(Closure , CallSite , CodeContext , Object ,
String , PythonTuple , IAttributesCollection )
   at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext
context, String name, Object[] bases, String selfNames,
IAttributesCollection vars)
   at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext
context, String name, Object[] bases, String selfNames, CallTarget0
body)
   at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope,
LanguageContext $language)
   at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression
code, Scope scope)
   at Microsoft.Scripting.ScriptCode.Run(Scope scope)
   at IronPython.Runtime.PythonContext.CreateModule(String fileName,
Scope scope, ScriptCode scriptCode, ModuleOptions options)
   at IronPython.Runtime.ModuleLoader.load_module(CodeContext context,
String fullName)
   at _stub_$367##225(Closure , CallSite , CodeContext , Object ,
Object[] )
   at IronPython.Runtime.PythonContext.Call(Object func, Object[]
args)
   at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter
(CodeContext context, Object importer, String fullName, List path,
Object& ret)
   at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext
context, String fullName, List path, Object& ret)
   at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule
(CodeContext context, String fullName, List path, Object& ret)
   at IronPython.Runtime.Importer.ImportNestedModule(CodeContext
context, Scope scope, String name, List path)
   at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext
context, Object from, String name)
   at IronPython.Runtime.Importer.ImportModule(CodeContext context,
Object globals, String modName, Boolean bottom, Int32 level)
   at IronPython.Runtime.Builtin.__import__(CodeContext context,
String name, Object globals, Object locals, Object fromlist, Int32
level)
   at IronPython.Runtime.Builtin.__import__(CodeContext context,
String name)
   at _stub_$548##406(Closure , CallSite , CodeContext , Object ,
Object )
   at DLRCachedCode.worker$736(Closure )
CLS Stack trace:

   at System.ThrowHelper.ThrowInvalidOperationException
(ExceptionResource resource)
   at
System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext
()
   at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod
(MethodInfo mi, String newName)
   at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type
finishedType, Dictionary`2 specialNames)
   at IronPython.Runtime.Types.NewTypeMaker.CreateNewType()
   at
IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.<GetNewType>b__0
()
   at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key,
Func`1 create)
   at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String
typeName, PythonTuple bases, IAttributesCollection dict)
   at IronPython.Runtime.Types.PythonType..ctor(CodeContext context,
String name, PythonTuple bases, IAttributesCollection dict)
   at IronPython.Runtime.Types.PythonType.__new__(CodeContext context,
PythonType cls, String name, PythonTuple bases, IAttributesCollection
dict)
   at _stub_$270##128(Closure , CallSite , CodeContext , Object ,
String , PythonTuple , IAttributesCollection )
   at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext
context, String name, Object[] bases, String selfNames,
IAttributesCollection vars)
   at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext
context, String name, Object[] bases, String selfNames, CallTarget0
body)
   at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope,
LanguageContext $language)
   at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression
code, Scope scope)
   at Microsoft.Scripting.ScriptCode.Run(Scope scope)
   at IronPython.Runtime.PythonContext.CreateModule(String fileName,
Scope scope, ScriptCode scriptCode, ModuleOptions options)
   at IronPython.Runtime.ModuleLoader.load_module(CodeContext context,
String fullName)
   at _stub_$367##225(Closure , CallSite , CodeContext , Object ,
Object[] )
   at IronPython.Runtime.PythonContext.Call(Object func, Object[]
args)
   at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter
(CodeContext context, Object importer, String fullName, List path,
Object& ret)
   at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext
context, String fullName, List path, Object& ret)
   at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule
(CodeContext context, String fullName, List path, Object& ret)
   at IronPython.Runtime.Importer.ImportNestedModule(CodeContext
context, Scope scope, String name, List path)
   at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext
context, Object from, String name)
   at IronPython.Runtime.Importer.ImportModule(CodeContext context,
Object globals, String modName, Boolean bottom, Int32 level)
   at IronPython.Runtime.Builtin.__import__(CodeContext context,
String name, Object globals, Object locals, Object fromlist, Int32
level)
   at IronPython.Runtime.Builtin.__import__(CodeContext context,
String name)
   at _stub_$548##406(Closure , CallSite , CodeContext , Object ,
Object )
   at DLRCachedCode.worker$736(Closure )




More information about the Ironpython-users mailing list