Mono 5 crashes during exit when the WeakRefTracker finalizer runs. I'm not sure if this is a mono bug or an IronPython bug. All my application does is import a module and exit. Some modules do not exhibit this problem (time) where other modules do exhibit this problem (codexmllib). This does not reproduce on mono 4.8. My test application is using the IronPython 2.7.7 nuget package.
My test application is:
namespace PythonTest
{
class Program
{
public static void Main(string[] args)
{
var engine = IronPython.Hosting.Python.CreateEngine();
// Add IronPython.StdLib to the search path
var basePath = PlatformServices.Default.Application.ApplicationBasePath;
var pythonPath = Path.Combine(basePath, "Python");
var paths = engine.GetSearchPaths();
paths.Add(pythonPath);
engine.SetSearchPaths(paths);
foreach (var item in args)
{
Console.WriteLine("Importing module {0}", item);
engine.ImportModule(item);
}
Console.WriteLine("SUCCESS!");
}
}
}
The failing output is:
Importing module xmllib
SUCCESS!
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Delegate.CreateDelegate_internal (System.Type,object,System.Reflection.MethodInfo,bool) [0x00000] in <4dc8ec68b0964e099af86e50301f5f3c>:0
at System.Delegate.CreateDelegate (System.Type,object,System.Reflection.MethodInfo,bool,bool) [0x002f0] in <4dc8ec68b0964e099af86e50301f5f3c>:0
at System.Delegate.CreateDelegate (System.Type,object,System.Reflection.MethodInfo) [0x00000] in <4dc8ec68b0964e099af86e50301f5f3c>:0
at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type,object) [0x0001a] in <4dc8ec68b0964e099af86e50301f5f3c>:0
at System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate () [0x00022] in <c716d84e34fc4c408a98d9a0c1024723>:0
at System.Linq.Expressions.Compiler.LambdaCompiler.Compile (System.Linq.Expressions.LambdaExpression) [0x00013] in <c716d84e34fc4c408a98d9a0c1024723>:0
at System.Linq.Expressions.Expression`1<TDelegate_REF>.Compile (bool) [0x00000] in <c716d84e34fc4c408a98d9a0c1024723>:0
at System.Linq.Expressions.Expression`1<TDelegate_REF>.Compile () [0x00000] in <c716d84e34fc4c408a98d9a0c1024723>:0
at System.Runtime.CompilerServices.CallSiteBinder.BindCore<T_REF> (System.Runtime.CompilerServices.CallSite`1<T_REF>,object[]) [0x0003b] in <c716d84e34fc4c408a98d9a0c1024723>:0
at System.Dynamic.UpdateDelegates.UpdateAndExecute1<object, bool> (System.Runtime.CompilerServices.CallSite,object) [0x000f1] in <c716d84e34fc4c408a98d9a0c1024723>:0
at IronPython.Runtime.Binding.PythonConversionBinder.BoolConversion (System.Runtime.CompilerServices.CallSite,object) [0x0001f] in <1304a224b80f47cdada4a1f932239862>:0
at IronPython.Runtime.Converter.ConvertToBoolean (object) [0x00000] in <1304a224b80f47cdada4a1f932239862>:0
at IronPython.Compiler.Ast.DynamicConvertExpression/BooleanConversionInstruction.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00007] in <1304a224b80f47cdada4a1f932239862>:0
at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <48823422b7404dddb2a834a9795980bd>:0
at Microsoft.Scripting.Interpreter.LightLambda.Run3<T0_REF, T1_REF, T2_REF, TRet_REF> (T0_REF,T1_REF,T2_REF) [0x0005c] in <48823422b7404dddb2a834a9795980bd>:0
at IronPython.Compiler.PythonCallTargets.OriginalCallTarget2 (IronPython.Runtime.PythonFunction,object,object) [0x00012] in <1304a224b80f47cdada4a1f932239862>:0
at Microsoft.Scripting.Interpreter.FuncCallInstruction`5<T0_REF, T1_REF, T2_REF, T3_REF, TRet_REF>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <48823422b7404dddb2a834a9795980bd>:0
at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <48823422b7404dddb2a834a9795980bd>:0
at Microsoft.Scripting.Interpreter.LightLambda.Run4<T0_REF, T1_REF, T2_REF, T3_REF, TRet_REF> (T0_REF,T1_REF,T2_REF,T3_REF) [0x0006d] in <48823422b7404dddb2a834a9795980bd>:0
at System.Dynamic.UpdateDelegates.UpdateAndExecute3<T0_REF, T1_REF, T2_REF, TRet_REF> (System.Runtime.CompilerServices.CallSite,T0_REF,T1_REF,T2_REF) [0x0011a] in <c716d84e34fc4c408a98d9a0c1024723>:0
at IronPython.Runtime.PythonContext.CallSplat (object,object[]) [0x0001d] in <1304a224b80f47cdada4a1f932239862>:0
at IronPython.Runtime.Operations.PythonCalls.Call (object,object[]) [0x00005] in <1304a224b80f47cdada4a1f932239862>:0
at IronPython.Runtime.WeakRefTracker.Finalize () [0x00056] in <1304a224b80f47cdada4a1f932239862>:0
at (wrapper runtime-invoke) object.runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr) [0x0001e] in <4dc8ec68b0964e099af86e50301f5f3c>:0
Mono information:
Mono JIT compiler version 5.0.0 (Stable 5.0.0.100/9667aa6 Thu May 11 14:33:04 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen (concurrent by default)
Mono 5 crashes during exit when the WeakRefTracker finalizer runs. I'm not sure if this is a mono bug or an IronPython bug. All my application does is import a module and exit. Some modules do not exhibit this problem (
time
) where other modules do exhibit this problem (code
xmllib
). This does not reproduce on mono 4.8. My test application is using the IronPython 2.7.7 nuget package.My test application is:
The failing output is:
Mono information: