Bug 59364 - Assertion at dynamic-image.c:209, condition `prev == MONO_HANDLE_RAW (obj)' not met
Summary: Assertion at dynamic-image.c:209, condition `prev == MONO_HANDLE_RAW (obj)' n...
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection (show other bugs)
Version: 5.4
Hardware: PC Linux
: --- major
Target Milestone: 15.4 SR1
Assignee: Aleksey Kliger
URL:
Depends on:
Blocks:
 
Reported: 2017-09-08 23:10 UTC by Alex Earl
Modified: 2017-10-18 04:55 UTC (History)
11 users (show)

See Also:
Tags:
Is this bug a regression?: Yes
Last known good build:


Attachments
reproduction case (2.89 MB, application/gzip)
2017-09-08 23:10 UTC, Alex Earl
Details
Moq based repro project (3.75 KB, application/zip)
2017-10-05 20:35 UTC, Oleg Demchenko
Details

Description Alex Earl 2017-09-08 23:10:25 UTC
Created attachment 24663 [details]
reproduction case

The following commit seems to cause a complete breakdown in IronPython on 5.4 for even simple scripts:

https://github.com/mono/mono/commit/792b5367cd3a6ffa1a192c4d2d7ace3509cbb646

This assertion fails: https://github.com/mono/mono/commit/792b5367cd3a6ffa1a192c4d2d7ace3509cbb646#diff-48fda43f79a03ed73f3e939c68db6b49R208

I am getting the following strack trace and debug data:

[mono] ~/Projects/repro @ mono ipy64.exe -c 'import os'
* Assertion at dynamic-image.c:213, condition `prev == MONO_HANDLE_RAW (obj)' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.Emit.ModuleBuilder.getToken (System.Reflection.Emit.ModuleBuilder,object,bool) [0x0000b] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at System.Reflection.Emit.ModuleBuilder.GetToken (System.Reflection.MemberInfo,bool) [0x00061] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at System.Reflection.Emit.ModuleBuilderTokenGenerator.GetToken (System.Reflection.MemberInfo,bool) [0x00000] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at System.Reflection.Emit.ILGenerator.Emit (System.Reflection.Emit.OpCode,System.Reflection.MethodInfo) [0x0004e] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at System.Reflection.Emit.ILGenerator.EmitCall (System.Reflection.Emit.OpCode,System.Reflection.MethodInfo,System.Type[]) [0x00084] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at Microsoft.Scripting.Generation.ILGen.EmitCall (System.Reflection.Emit.OpCode,System.Reflection.MethodInfo,System.Type[]) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Runtime.Types.NewTypeMaker.EmitBaseMethodDispatch (System.Reflection.MethodInfo,Microsoft.Scripting.Generation.ILGen) [0x00039] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Types.NewTypeMaker.CreateVTableMethodOverride (System.Reflection.MethodInfo,string) [0x00027] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Types.NewTypeMaker.OverrideBaseMethod (System.Reflection.MethodInfo,System.Collections.Generic.Dictionary`2<string, string[]>) [0x0007a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Types.NewTypeMaker.OverrideMethods (System.Type,System.Collections.Generic.Dictionary`2<string, string[]>) [0x0015c] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Types.NewTypeMaker.ImplementType () [0x00018] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Types.NewTypeMaker.CreateNewType () [0x00028] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Types.NewTypeMaker/<>c__DisplayClass24_0.<GetNewType>b__0 () [0x00050] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at Microsoft.Scripting.Utils.Publisher`2<TKey_REF, TValue_REF>.GetOrCreateValue (TKey_REF,System.Func`1<TValue_REF>) [0x000a5] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Runtime.Types.NewTypeMaker.GetNewType (string,IronPython.Runtime.PythonTuple) [0x0007f] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Types.PythonType.InitializeUserType (IronPython.Runtime.CodeContext,string,IronPython.Runtime.PythonTuple,IronPython.Runtime.PythonDictionary,string) [0x001be] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Types.PythonType..ctor (IronPython.Runtime.CodeContext,string,IronPython.Runtime.PythonTuple,IronPython.Runtime.PythonDictionary,string) [0x00027] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Types.PythonType.__new__ (IronPython.Runtime.CodeContext,IronPython.Runtime.Types.PythonType,string,IronPython.Runtime.PythonTuple,IronPython.Runtime.PythonDictionary,string) [0x00088] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Operations.PythonOps.MakeClass (IronPython.Runtime.CodeContext,string,object[],string,IronPython.Runtime.PythonDictionary) [0x00169] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Operations.PythonOps.MakeClass (IronPython.Runtime.FunctionCode,System.Func`2<IronPython.Runtime.CodeContext, IronPython.Runtime.CodeContext>,IronPython.Runtime.CodeContext,string,object[],string) [0x0001b] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at (wrapper delegate-invoke) System.Func`7<T1_REF, T2_REF, T3_REF, T4_REF, T5_REF, T6_REF, TResult_REF>.invoke_TResult_T1_T2_T3_T4_T5_T6 (T1_REF,T2_REF,T3_REF,T4_REF,T5_REF,T6_REF) [0x00056] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`7<T0_REF, T1_REF, T2_REF, T3_REF, T4_REF, T5_REF, TRet_REF>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.LightLambda.Run1<T0_REF, TRet_REF> (T0_REF) [0x0003e] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope) [0x0006a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.InitializeModule (string,IronPython.Runtime.ModuleContext,Microsoft.Scripting.ScriptCode,IronPython.Runtime.ModuleOptions) [0x00087] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions,Microsoft.Scripting.ScriptCode&) [0x0004f] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext,Microsoft.Scripting.SourceUnit,string,string) [0x00006] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext,string,string) [0x00040] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext,string,string,string) [0x00032] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List,System.Func`5<IronPython.Runtime.CodeContext, string, string, string, object>) [0x0007a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext,string) [0x00069] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext,object,string,bool,int) [0x001da] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext,string,object,object,object,int) [0x0003c] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at (wrapper delegate-invoke) System.Func`7<IronPython.Runtime.CodeContext, string, object, object, object, int, object>.invoke_TResult_T1_T2_T3_T4_T5_T6 (IronPython.Runtime.CodeContext,string,object,object,object,int) [0x00056] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`7<IronPython.Runtime.CodeContext, string, object, object, object, int, object>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.LightLambda.Run7<T0_REF, T1_REF, T2_REF, T3_REF, T4_REF, T5_REF, T6_REF, TRet_REF> (T0_REF,T1_REF,T2_REF,T3_REF,T4_REF,T5_REF,T6_REF) [0x000a0] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext,string,IronPython.Runtime.PythonTuple,int) [0x0002d] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Operations.PythonOps.ImportWithNames (IronPython.Runtime.CodeContext,string,string[],int) [0x00008] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`5<IronPython.Runtime.CodeContext, string, string[], int, object>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.LightLambda.Run1<T0_REF, TRet_REF> (T0_REF) [0x0003e] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope) [0x0006a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.InitializeModule (string,IronPython.Runtime.ModuleContext,Microsoft.Scripting.ScriptCode,IronPython.Runtime.ModuleOptions) [0x00087] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions,Microsoft.Scripting.ScriptCode&) [0x0004f] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext,Microsoft.Scripting.SourceUnit,string,string) [0x00006] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext,string,string) [0x00040] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext,string,string,string) [0x00032] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List,System.Func`5<IronPython.Runtime.CodeContext, string, string, string, object>) [0x0007a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext,string) [0x00069] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext,object,string,bool,int) [0x001da] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext,string,object,object,object,int) [0x0003c] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at (wrapper delegate-invoke) System.Func`7<IronPython.Runtime.CodeContext, string, object, object, object, int, object>.invoke_TResult_T1_T2_T3_T4_T5_T6 (IronPython.Runtime.CodeContext,string,object,object,object,int) [0x00056] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`7<IronPython.Runtime.CodeContext, string, object, object, object, int, object>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.LightLambda.Run7<T0_REF, T1_REF, T2_REF, T3_REF, T4_REF, T5_REF, T6_REF, TRet_REF> (T0_REF,T1_REF,T2_REF,T3_REF,T4_REF,T5_REF,T6_REF) [0x000a0] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext,string,IronPython.Runtime.PythonTuple,int) [0x0002d] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Operations.PythonOps.ImportTop (IronPython.Runtime.CodeContext,string,int) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`4<IronPython.Runtime.CodeContext, string, int, object>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.LightLambda.Run1<T0_REF, TRet_REF> (T0_REF) [0x0003e] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope) [0x0006a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.InitializeModule (string,IronPython.Runtime.ModuleContext,Microsoft.Scripting.ScriptCode,IronPython.Runtime.ModuleOptions) [0x00087] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions,Microsoft.Scripting.ScriptCode&) [0x0004f] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext,Microsoft.Scripting.SourceUnit,string,string) [0x00006] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext,string,string) [0x00040] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext,string,string,string) [0x00032] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List,System.Func`5<IronPython.Runtime.CodeContext, string, string, string, object>) [0x0007a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext,string) [0x00069] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext,object,string,bool,int) [0x001da] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext,string,object,object,object,int) [0x0003c] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at (wrapper delegate-invoke) System.Func`7<IronPython.Runtime.CodeContext, string, object, object, object, int, object>.invoke_TResult_T1_T2_T3_T4_T5_T6 (IronPython.Runtime.CodeContext,string,object,object,object,int) [0x00056] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`7<IronPython.Runtime.CodeContext, string, object, object, object, int, object>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.LightLambda.Run7<T0_REF, T1_REF, T2_REF, T3_REF, T4_REF, T5_REF, T6_REF, TRet_REF> (T0_REF,T1_REF,T2_REF,T3_REF,T4_REF,T5_REF,T6_REF) [0x000a0] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext,string,IronPython.Runtime.PythonTuple,int) [0x0002d] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Operations.PythonOps.ImportTop (IronPython.Runtime.CodeContext,string,int) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`4<IronPython.Runtime.CodeContext, string, int, object>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.LightLambda.Run1<T0_REF, TRet_REF> (T0_REF) [0x0003e] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope) [0x0006a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.InitializeModule (string,IronPython.Runtime.ModuleContext,Microsoft.Scripting.ScriptCode,IronPython.Runtime.ModuleOptions) [0x00087] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions,Microsoft.Scripting.ScriptCode&) [0x0004f] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext,Microsoft.Scripting.SourceUnit,string,string) [0x00006] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext,string,string) [0x00040] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext,string,string,string) [0x00032] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List,System.Func`5<IronPython.Runtime.CodeContext, string, string, string, object>) [0x0007a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext,string) [0x00069] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext,object,string,bool,int) [0x001da] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Modules.Builtin.__import__ (IronPython.Runtime.CodeContext,string,object,object,object,int) [0x0003c] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at (wrapper delegate-invoke) System.Func`7<IronPython.Runtime.CodeContext, string, object, object, object, int, object>.invoke_TResult_T1_T2_T3_T4_T5_T6 (IronPython.Runtime.CodeContext,string,object,object,object,int) [0x00056] in <6cf8118aa32049e09e582d43b1ccae69>:0
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`7<IronPython.Runtime.CodeContext, string, object, object, object, int, object>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.LightLambda.Run7<T0_REF, T1_REF, T2_REF, T3_REF, T4_REF, T5_REF, T6_REF, TRet_REF> (T0_REF,T1_REF,T2_REF,T3_REF,T4_REF,T5_REF,T6_REF) [0x000a0] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Runtime.Importer.ImportLightThrow (IronPython.Runtime.CodeContext,string,IronPython.Runtime.PythonTuple,int) [0x0002d] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Operations.PythonOps.ImportTop (IronPython.Runtime.CodeContext,string,int) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at Microsoft.Scripting.Interpreter.FuncCallInstruction`4<IronPython.Runtime.CodeContext, string, int, object>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00000] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Interpreter.LightLambda.Run1<T0_REF, TRet_REF> (T0_REF) [0x0003e] in <a41c3596f50d4f3692142531a28a2368>:0
  at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope) [0x0006a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.InitializeModule (string,IronPython.Runtime.ModuleContext,Microsoft.Scripting.ScriptCode,IronPython.Runtime.ModuleOptions) [0x00087] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions,Microsoft.Scripting.ScriptCode&) [0x0004f] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.PythonContext.CompileModule (string,string,Microsoft.Scripting.SourceUnit,IronPython.Runtime.ModuleOptions) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromSourceUnit (IronPython.Runtime.CodeContext,Microsoft.Scripting.SourceUnit,string,string) [0x00006] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadModuleFromSource (IronPython.Runtime.CodeContext,string,string) [0x00040] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.LoadFromDisk (IronPython.Runtime.CodeContext,string,string,string) [0x00032] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPathHook (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List,System.Func`5<IronPython.Runtime.CodeContext, string, string, string, object>) [0x0007a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportFromPath (IronPython.Runtime.CodeContext,string,string,IronPython.Runtime.List) [0x00000] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportTopAbsolute (IronPython.Runtime.CodeContext,string) [0x00069] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Runtime.Importer.ImportModule (IronPython.Runtime.CodeContext,object,string,bool,int) [0x001da] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Hosting.PythonCommandLine.ImportSite () [0x0001a] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at IronPython.Hosting.PythonCommandLine.Initialize () [0x000ae] in <8a332d2a371840fa9dc33e1cee47c3ee>:0
  at Microsoft.Scripting.Hosting.Shell.CommandLine.Run (Microsoft.Scripting.Hosting.ScriptEngine,Microsoft.Scripting.Hosting.Shell.IConsole,Microsoft.Scripting.Hosting.Shell.ConsoleOptions) [0x00036] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Hosting.Shell.ConsoleHost.RunCommandLine () [0x00053] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Hosting.Shell.ConsoleHost.ExecuteInternal () [0x00051] in <a41c3596f50d4f3692142531a28a2368>:0
  at PythonConsoleHost.ExecuteInternal () [0x00025] in <94f22719528a4f089cd79c131cca6586>:0
  at Microsoft.Scripting.Hosting.Shell.ConsoleHost.Execute () [0x00032] in <a41c3596f50d4f3692142531a28a2368>:0
  at Microsoft.Scripting.Hosting.Shell.ConsoleHost.Run (string[]) [0x0015b] in <a41c3596f50d4f3692142531a28a2368>:0
  at PythonConsoleHost.Main (string[]) [0x00020] in <94f22719528a4f089cd79c131cca6586>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00054] in <94f22719528a4f089cd79c131cca6586>:0
/proc/self/maps:
4192a000-41b0a000 rwxp 00000000 00:00 0 
41d49000-41d59000 rwxp 00000000 00:00 0 
5639c3eeb000-5639c42d2000 r-xp 00000000 fd:00 713409                     /opt/mono/bin/mono-sgen
5639c44d2000-5639c44d8000 r--p 003e7000 fd:00 713409                     /opt/mono/bin/mono-sgen
5639c44d8000-5639c44da000 rw-p 003ed000 fd:00 713409                     /opt/mono/bin/mono-sgen
5639c44da000-5639c4531000 rw-p 00000000 00:00 0 
5639c480e000-5639c581b000 rw-p 00000000 00:00 0                          [heap]
7fd3f8000000-7fd3f8045000 rw-p 00000000 00:00 0 
7fd3f8045000-7fd3fc000000 ---p 00000000 00:00 0 
7fd400000000-7fd400021000 rw-p 00000000 00:00 0 
7fd400021000-7fd404000000 ---p 00000000 00:00 0 
7fd404000000-7fd40407d000 rw-p 00000000 00:00 0 
7fd40407d000-7fd408000000 ---p 00000000 00:00 0 
7fd408000000-7fd408021000 rw-p 00000000 00:00 0 
7fd408021000-7fd40c000000 ---p 00000000 00:00 0 
7fd40e184000-7fd40e204000 rw-p 00000000 00:00 0 
7fd40e208000-7fd40e288000 rw-p 00000000 00:00 0 
7fd40e28c000-7fd40e30c000 rw-p 00000000 00:00 0 
7fd40e310000-7fd40e390000 rw-p 00000000 00:00 0 
7fd40e394000-7fd40e414000 rw-p 00000000 00:00 0 
7fd40e418000-7fd40e498000 rw-p 00000000 00:00 0 
7fd40e499000-7fd40e4a2000 ---p 00000000 00:00 0 
7fd40e4a2000-7fd40e69a000 rw-p 00000000 00:00 0 
7fd40e69a000-7fd40e6a3000 ---p 00000000 00:00 0 
7fd40e6a3000-7fd40e89b000 rw-p 00000000 00:00 0 
7fd40e89b000-7fd40e8a4000 ---p 00000000 00:00 0 
7fd40e8a4000-7fd40ea9c000 rw-p 00000000 00:00 0 
7fd40ea9c000-7fd40eb49000 r--p 00000000 00:2e 1092930                    /home/USER/Projects/repro/IronPython.Modules.dll
7fd40eb49000-7fd40ed00000 r--p 00000000 00:2e 1092929                    /home/USER/Projects/repro/IronPython.dll
7fd40ed00000-7fd40ee00000 rw-p 00000000 00:00 0 
7fd40ee1c000-7fd40ee9c000 rw-p 00000000 00:00 0 
7fd40ee9e000-7fd40f19f000 r--p 00000000 fd:00 715049                     /opt/mono/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
7fd40f19f000-7fd40f43e000 r--p 00000000 fd:00 715044                     /opt/mono/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
7fd40f43e000-7fd40f536000 r--p 00000000 fd:00 715064                     /opt/mono/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
7fd40f536000-7fd40f53f000 ---p 00000000 00:00 0 
7fd40f53f000-7fd40f737000 rw-p 00000000 00:00 0 
7fd40f737000-7fd40fe2b000 r-xp 00000000 fd:00 715035                     /opt/mono/lib/mono/4.5/mscorlib.dll.so
7fd40fe2b000-7fd41002a000 ---p 006f4000 fd:00 715035                     /opt/mono/lib/mono/4.5/mscorlib.dll.so
7fd41002a000-7fd41002b000 r--p 006f3000 fd:00 715035                     /opt/mono/lib/mono/4.5/mscorlib.dll.so
7fd41002b000-7fd41002c000 rw-p 006f4000 fd:00 715035                     /opt/mono/lib/mono/4.5/mscorlib.dll.so
7fd41002c000-7fd410049000 rw-p 00000000 00:00 0 
7fd410049000-7fd4103ff000 r--p 00000000 fd:00 715032                     /opt/mono/lib/mono/4.5/mscorlib.dll
7fd4103ff000-7fd4113ff000 rw-p 00000000 00:00 0 
7fd4113ff000-7fd411400000 ---p 00000000 00:00 0 
7fd411400000-7fd412000000 rw-p 00000000 00:00 0 
7fd412040000-7fd412050000 rwxp 00000000 00:00 0 
7fd412050000-7fd412056000 rw-p 00000000 00:00 0 
7fd412058000-7fd412072000 rw-p 00000000 00:00 0 
7fd412072000-7fd41208e000 r--p 00000000 fd:00 715109                     /opt/mono/lib/mono/gac/System.Numerics/4.0.0.0__b77a5c561934e089/System.Numerics.dll
7fd41208e000-7fd412196000 r--p 00000000 00:2e 1092932                    /home/USER/Projects/repro/Microsoft.Dynamic.dll
7fd412196000-7fd412471000 r--p 00000000 fd:00 1317082                    /usr/lib/locale/locale-archive
7fd412471000-7fd41262f000 r-xp 00000000 fd:00 1054512                    /lib/x86_64-linux-gnu/libc-2.24.so
7fd41262f000-7fd41282e000 ---p 001be000 fd:00 1054512                    /lib/x86_64-linux-gnu/libc-2.24.so
7fd41282e000-7fd412832000 r--p 001bd000 fd:00 1054512                    /lib/x86_64-linux-gnu/libc-2.24.so
7fd412832000-7fd412834000 rw-p 001c1000 fd:00 1054512                    /lib/x86_64-linux-gnu/libc-2.24.so
7fd412834000-7fd412838000 rw-p 00000000 00:00 0 
7fd412838000-7fd41284e000 r-xp 00000000 fd:00 1054265                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd41284e000-7fd412a4d000 ---p 00016000 fd:00 1054265                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd412a4d000-7fd412a4e000 r--p 00015000 fd:00 1054265                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd412a4e000-7fd412a4f000 rw-p 00016000 fd:00 1054265                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd412a4f000-7fd412a67000 r-xp 00000000 fd:00 1054977                    /lib/x86_64-linux-gnu/libpthread-2.24.so
7fd412a67000-7fd412c67000 ---p 00018000 fd:00 1054977                    /lib/x86_64-linux-gnu/libpthread-2.24.so
7fd412c67000-7fd412c68000 r--p 00018000 fd:00 1054977                    /lib/x86_64-linux-gnu/libpthread-2.24.so
7fd412c68000-7fd412c69000 rw-p 00019000 fd:00 1054977                    /lib/x86_64-linux-gnu/libpthread-2.24.so
7fd412c69000-7fd412c6d000 rw-p 00000000 00:00 0 
7fd412c6d000-7fd412c70000 r-xp 00000000 fd:00 1054515                    /lib/x86_64-linux-gnu/libdl-2.24.so
7fd412c70000-7fd412e6f000 ---p 00003000 fd:00 1054515                    /lib/x86_64-linux-gnu/libdl-2.24.so
7fd412e6f000-7fd412e70000 r--p 00002000 fd:00 1054515                    /lib/x86_64-linux-gnu/libdl-2.24.so
7fd412e70000-7fd412e71000 rw-p 00003000 fd:00 1054515                    /lib/x86_64-linux-gnu/libdl-2.24.so
7fd412e71000-7fd412e78000 r-xp 00000000 fd:00 1055380                    /lib/x86_64-linux-gnu/librt-2.24.so
7fd412e78000-7fd413077000 ---p 00007000 fd:00 1055380                    /lib/x86_64-linux-gnu/librt-2.24.so
7fd413077000-7fd413078000 r--p 00006000 fd:00 1055380                    /lib/x86_64-linux-gnu/librt-2.24.so
7fd413078000-7fd413079000 rw-p 00007000 fd:00 1055380                    /lib/x86_64-linux-gnu/librt-2.24.so
7fd413079000-7fd413181000 r-xp 00000000 fd:00 1054528                    /lib/x86_64-linux-gnu/libm-2.24.so
7fd413181000-7fd413380000 ---p 00108000 fd:00 1054528                    /lib/x86_64-linux-gnu/libm-2.24.so
7fd413380000-7fd413381000 r--p 00107000 fd:00 1054528                    /lib/x86_64-linux-gnu/libm-2.24.so
7fd413381000-7fd413382000 rw-p 00108000 fd:00 1054528                    /lib/x86_64-linux-gnu/libm-2.24.so
7fd413382000-7fd4133a8000 r-xp 00000000 fd:00 1054061                    /lib/x86_64-linux-gnu/ld-2.24.so
7fd4133a8000-7fd4133b1000 rw-p 00000000 00:00 0 
7fd4133b1000-7fd4133fd000 r--p 00000000 fd:00 715039                     /opt/mono/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
7fd4133fd000-7fd41341b000 r--p 00000000 fd:00 715074                     /opt/mono/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
7fd41341b000-7fd41343e000 r--p 00000000 00:2e 1092933                    /home/USER/Projects/repro/Microsoft.Scripting.dll
7fd41343e000-7fd413526000 rw-p 00000000 00:00 0 
7fd413526000-7fd413585000 ---p 00000000 00:00 0 
7fd413585000-7fd41358e000 rw-p 00000000 00:00 0 
7fd41358e000-7fd413593000 rw-p 00000000 00:00 0 
7fd413593000-7fd413598000 r--p 00000000 00:2e 1092923                    /home/USER/Projects/repro/ipy64.exe
7fd413598000-7fd4135a3000 rw-p 00000000 00:00 0 
7fd4135a3000-7fd4135a4000 rw-s 00000000 00:14 253959                     /dev/shm/mono.15749
7fd4135a4000-7fd4135a7000 rw-p 00000000 00:00 0 
7fd4135a7000-7fd4135a8000 r--p 00025000 fd:00 1054061                    /lib/x86_64-linux-gnu/ld-2.24.so
7fd4135a8000-7fd4135a9000 rw-p 00026000 fd:00 1054061                    /lib/x86_64-linux-gnu/ld-2.24.so
7fd4135a9000-7fd4135aa000 rw-p 00000000 00:00 0 
7fff236df000-7fff236e7000 ---p 00000000 00:00 0 
7fff23ebd000-7fff23ede000 rw-p 00000000 00:00 0                          [stack]
7fff23faa000-7fff23fac000 r--p 00000000 00:00 0                          [vvar]
7fff23fac000-7fff23fae000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

Native stacktrace:

	mono(+0xc2a5c) [0x5639c3fada5c]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x11670) [0x7fd412a60670]
	/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x9f) [0x7fd4124a677f]
	/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7fd4124a837a]
	mono(+0x2b04b9) [0x5639c419b4b9]
	mono(monoeg_g_logv+0x4d) [0x5639c41b059d]
	mono(monoeg_assertion_message+0xa3) [0x5639c41b0733]
	mono(+0x2300c9) [0x5639c411b0c9]
	mono(+0x23373f) [0x5639c411e73f]
	[0x41adc0a7]

Debug info from gdb:

[New LWP 15750]
[New LWP 15751]
[New LWP 15752]
[New LWP 15753]
[New LWP 15754]
warning: File "/opt/mono/bin/mono-sgen-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
	add-auto-load-safe-path /opt/mono/bin/mono-sgen-gdb.py
line to your configuration file "/home/USER/.gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/USER/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fd412a6008a in __waitpid (pid=pid@entry=15755, stat_loc=stat_loc@entry=0x7fff23ed576c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
29	../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
  Id   Target Id         Frame 
* 1    Thread 0x7fd413585740 (LWP 15749) "mono" 0x00007fd412a6008a in __waitpid (pid=pid@entry=15755, stat_loc=stat_loc@entry=0x7fff23ed576c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
  2    Thread 0x7fd411bff700 (LWP 15750) "SGen worker" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  3    Thread 0x7fd40f736700 (LWP 15751) "Finalizer" 0x00007fd412a5ea06 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x5639c451f640 <finalizer_sem>) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
  4    Thread 0x7fd40ea9b700 (LWP 15752) "mono" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
  5    Thread 0x7fd40e89a700 (LWP 15753) "Threadpool work" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
  6    Thread 0x7fd40e699700 (LWP 15754) "Threadpool work" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225

Thread 6 (Thread 0x7fd40e699700 (LWP 15754)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
#1  0x00005639c419db8b in mono_os_cond_timedwait (cond=cond@entry=0x5639c44defb8 <worker+120>, mutex=mutex@entry=0x5639c44def88 <worker+72>, timeout_ms=timeout_ms@entry=25116) at mono-os-mutex.c:75
#2  0x00005639c40f9999 in mono_coop_cond_timedwait (cond=0x5639c44defb8 <worker+120>, mutex=0x5639c44def88 <worker+72>, timeout_ms=25116) at ../../mono/utils/mono-coop-mutex.h:102
#3  worker_park () at threadpool-worker-default.c:418
#4  worker_thread (unused=unused@entry=0x0) at threadpool-worker-default.c:488
#5  0x00005639c40f25ac in start_wrapper_internal (stack_ptr=<optimized out>, start_info=0x0) at threads.c:983
#6  start_wrapper (data=0x7fd404036910) at threads.c:1045
#7  0x00007fd412a566da in start_thread (arg=0x7fd40e699700) at pthread_create.c:456
#8  0x00007fd412579d7f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105

Thread 5 (Thread 0x7fd40e89a700 (LWP 15753)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
#1  0x00005639c419db8b in mono_os_cond_timedwait (cond=cond@entry=0x5639c44defb8 <worker+120>, mutex=mutex@entry=0x5639c44def88 <worker+72>, timeout_ms=timeout_ms@entry=13449) at mono-os-mutex.c:75
#2  0x00005639c40f9999 in mono_coop_cond_timedwait (cond=0x5639c44defb8 <worker+120>, mutex=0x5639c44def88 <worker+72>, timeout_ms=13449) at ../../mono/utils/mono-coop-mutex.h:102
#3  worker_park () at threadpool-worker-default.c:418
#4  worker_thread (unused=unused@entry=0x0) at threadpool-worker-default.c:488
#5  0x00005639c40f25ac in start_wrapper_internal (stack_ptr=<optimized out>, start_info=0x0) at threads.c:983
#6  start_wrapper (data=0x5639c51e38e0) at threads.c:1045
#7  0x00007fd412a566da in start_thread (arg=0x7fd40e89a700) at pthread_create.c:456
#8  0x00007fd412579d7f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105

Thread 4 (Thread 0x7fd40ea9b700 (LWP 15752)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
#1  0x00005639c419db8b in mono_os_cond_timedwait (cond=cond@entry=0x5639c452ef60 <sleep_cond>, mutex=mutex@entry=0x5639c452efa0 <sleep_mutex>, timeout_ms=timeout_ms@entry=500) at mono-os-mutex.c:75
#2  0x00005639c41a7631 in mono_coop_cond_timedwait (cond=0x5639c452ef60 <sleep_cond>, mutex=0x5639c452efa0 <sleep_mutex>, timeout_ms=500) at ../../mono/utils/mono-coop-mutex.h:102
#3  sleep_interruptable (alerted=0x7fd40ea9adf4, ms=500) at mono-threads.c:1270
#4  mono_thread_info_sleep (ms=ms@entry=500, alerted=alerted@entry=0x7fd40ea9adf4) at mono-threads.c:1302
#5  0x00005639c40fa402 in monitor_thread (unused=unused@entry=0x0) at threadpool-worker-default.c:704
#6  0x00005639c40f25ac in start_wrapper_internal (stack_ptr=<optimized out>, start_info=0x0) at threads.c:983
#7  start_wrapper (data=0x5639c51e4270) at threads.c:1045
#8  0x00007fd412a566da in start_thread (arg=0x7fd40ea9b700) at pthread_create.c:456
#9  0x00007fd412579d7f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105

Thread 3 (Thread 0x7fd40f736700 (LWP 15751)):
#0  0x00007fd412a5ea06 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x5639c451f640 <finalizer_sem>) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x5639c451f640 <finalizer_sem>, abstime=0x0) at sem_waitcommon.c:111
#2  0x00007fd412a5eab4 in __new_sem_wait_slow (sem=0x5639c451f640 <finalizer_sem>, abstime=0x0) at sem_waitcommon.c:181
#3  0x00007fd412a5eb5a in __new_sem_wait (sem=sem@entry=0x5639c451f640 <finalizer_sem>) at sem_wait.c:29
#4  0x00005639c4132c72 in mono_os_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0x5639c451f640 <finalizer_sem>) at ../../mono/utils/mono-os-semaphore.h:210
#5  mono_coop_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0x5639c451f640 <finalizer_sem>) at ../../mono/utils/mono-coop-semaphore.h:43
#6  finalizer_thread (unused=unused@entry=0x0) at gc.c:864
#7  0x00005639c40f25ac in start_wrapper_internal (stack_ptr=<optimized out>, start_info=0x0) at threads.c:983
#8  start_wrapper (data=0x5639c486c880) at threads.c:1045
#9  0x00007fd412a566da in start_thread (arg=0x7fd40f736700) at pthread_create.c:456
#10 0x00007fd412579d7f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105

Thread 2 (Thread 0x7fd411bff700 (LWP 15750)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00005639c4190f0b in mono_os_cond_wait (mutex=0x5639c452e500 <lock>, cond=0x5639c452e4c0 <work_cond>) at ../../mono/utils/mono-os-mutex.h:173
#2  get_work (job=<synthetic pointer>, do_idle=<synthetic pointer>, work_context=<synthetic pointer>, worker_index=0) at sgen-thread-pool.c:165
#3  thread_func (data=<optimized out>) at sgen-thread-pool.c:196
#4  0x00007fd412a566da in start_thread (arg=0x7fd411bff700) at pthread_create.c:456
#5  0x00007fd412579d7f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105

Thread 1 (Thread 0x7fd413585740 (LWP 15749)):
#0  0x00007fd412a6008a in __waitpid (pid=pid@entry=15755, stat_loc=stat_loc@entry=0x7fff23ed576c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00005639c3fadb40 in mono_handle_native_crash (signal=0x5639c41d4aa6 "SIGABRT", ctx=<optimized out>, info=<optimized out>) at mini-exceptions.c:2721
#2  <signal handler called>
#3  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
#4  0x00007fd4124a837a in __GI_abort () at abort.c:89
#5  0x00005639c419b4b9 in mono_log_write_logfile (log_domain=<optimized out>, level=<optimized out>, hdr=<optimized out>, message=0x5639c57b4480 "* Assertion at dynamic-image.c:213, condition `prev == MONO_HANDLE_RAW (obj)' not met\n") at mono-log-common.c:135
#6  0x00005639c41b059d in monoeg_g_logv (log_domain=log_domain@entry=0x0, log_level=log_level@entry=G_LOG_LEVEL_ERROR, format=format@entry=0x5639c41b9db0 "* Assertion at %s:%d, condition `%s' not met\n", args=args@entry=0x7fff23ed6800) at goutput.c:115
#7  0x00005639c41b0733 in monoeg_assertion_message (format=format@entry=0x5639c41b9db0 "* Assertion at %s:%d, condition `%s' not met\n") at goutput.c:135
#8  0x00005639c411b0c9 in mono_dynamic_image_register_token (assembly=assembly@entry=0x5639c56760a0, token=token@entry=167772182, obj=obj@entry=0x5639c48197d0, how_collide=how_collide@entry=1) at dynamic-image.c:213
#9  0x00005639c411e73f in mono_image_create_token (assembly=0x5639c56760a0, obj=0x5639c48197d0, create_open_instance=<optimized out>, register_token=<optimized out>, error=0x7fff23ed69d8) at sre.c:1201
#10 0x0000000041adc0a7 in ?? ()
#11 0x0000000000000001 in ?? ()
#12 0x0000000000000000 in ?? ()

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

The attached tar.gz file has a mostly stripped down reproduction case. You can see the error by running:

mono ipy64.exe -c "import os"
Comment 1 Ludovic Henry 2017-09-21 21:01:26 UTC
I can reproduce with Mono 5.6.0.83 (2017-08/48e94bd5f61) and Mono 5.7.0 (master/2e08526b14c)
Comment 3 Aleksey Kliger 2017-09-26 19:41:26 UTC
Thanks. The token+builder SRE code is pretty complex - I tried to add some discipline and looks like there's some case that got handled wrong.
Comment 4 Aleksey Kliger 2017-09-26 23:10:44 UTC
Oh this is interesting.  So the assertion says "you tried to register a token for a reflection object but I already have a registered object for that token and it's not the same as yours".

In this particular case both the old already registered object and the new object are a System.Reflection.MonoMethod for "Object.Equals(object, object)".  Aren't you supposed to get a ReferenceEqual object each time you say typeof(object).GetMethod("Equals")? Yes.

So how come there are two?  Because of 'MemberInfo:ReflectedType'.  What we actually have are typeof(object).GetMethod("Equals") and typeof(IronPython.Runtime.PythonProperty).GetMethod("Equals").  They both hold the same MonoMethod* to the runtime representation for the method.  So when we call `mono_image_get_methodref_token` from `mono_image_create_token` we get back the same token both times.  But then we try to map that token to two different System.Reflection.MonoMethod objects.

This *seems* like it should be harmless (after all, it only broke after I made `mono_dynamic_image_register_token` stricter).  So one solution is just to deterministically look up a reflection object to register rather than the one that was passed in.  (ie, once we know we'll need a memberref token for a MonoMethod*, look up its reflected object with ReflectedType == NULL and register that object not the original object). But let's see what the test cases say.

(Also this can probably assert for other subclasses of MemberInfo).
Comment 6 Alex Earl 2017-09-29 17:42:17 UTC
I ran the same reproduction case on the following version and don't see the issue anymore.

Mono JIT compiler version 5.7.0 (master/c6d92b99838 Fri Sep 29 08:57:20 MST 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)
Comment 10 Oleg Demchenko 2017-10-05 20:35:32 UTC
Created attachment 25130 [details]
Moq based repro project
Comment 11 bart.dekeersmaeker@mediahuis.be 2017-10-11 13:15:58 UTC
Any workaround to fix this issue ? 
All our builds are currently failing due to the update to the latest stable mono version.
Comment 12 Jonah 2017-10-11 13:25:41 UTC
Are there any workarounds? I'm having the same issue.
Comment 13 Tom Gilder 2017-10-11 14:40:44 UTC
Broken all our builds too.

Had to rollback to previous Mono stable, 5.2.0.224 from https://download.mono-project.com/archive/5.2.0/macos-10-universal/MonoFramework-MDK-5.2.0.224.macos10.xamarin.universal.pkg
Comment 14 Ludovic Henry 2017-10-12 17:05:51 UTC
The PR https://github.com/mono/mono/pull/5711 has been merged into 2017-06 with https://github.com/mono/mono/commit/fbc487ff424c479c25d0bbd24110d34890ffd793
Comment 15 Alex Earl 2017-10-18 04:55:46 UTC
I tested my specific use case (IronPython) with the fix and it works for me.

Note You need to log in before you can comment on or make changes to this bug.