Bug 39746 - Assertion at method-to-ir.c:11652 when using mono master/ca7b692f4 and nuget
Summary: Assertion at method-to-ir.c:11652 when using mono master/ca7b692f4 and nuget
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Aleksey Kliger
URL:
Depends on:
Blocks:
 
Reported: 2016-03-17 23:23 UTC by Alexander Köplinger [MSFT]
Modified: 2016-03-19 11:14 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Alexander Köplinger [MSFT] 2016-03-17 23:23:01 UTC
Steps:
1. wget https://dist.nuget.org/win-x86-commandline/v3.4.0-rc/nuget.exe
2. mono nuget.exe

Works fine with Mono 4.4, but crashes on mono master/ca7b692f4:

> * Assertion: should not be reached at method-to-ir.c:11652
> 
> Stacktrace:
> 
>   at <unknown> <0xffffffff>
>   at NuGet.CommandLine.Command.SetDefaultCredentialProvider () <0x0042f>
>   at NuGet.CommandLine.Command.Execute () <0x001eb>
>   at NuGet.CommandLine.Program.MainCore (string,string[]) <0x0088a>
>   at NuGet.CommandLine.Program.Main (string[]) <0x00028>
>   at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0x00112>
> 
> Native stacktrace:
> 
> 	0   mono                                0x000000010303b91e mono_handle_native_sigsegv + 334
> 	1   mono                                0x00000001031122f5 sigabrt_signal_handler + 165
> 	2   libsystem_platform.dylib            0x00007fff94929eaa _sigtramp + 26
> 	3   ???                                 0x0000000000000003 0x0 + 3
> 	4   libsystem_c.dylib                   0x00007fff87def6e7 abort + 129
> 	5   mono                                0x000000010333ed23 monoeg_log_default_handler + 211
> 	6   mono                                0x000000010333ec32 monoeg_g_logv + 114
> 	7   mono                                0x000000010333f034 monoeg_assertion_message + 356
> 	8   mono                                0x0000000102f5793f mono_method_to_ir + 177679
> 	9   mono                                0x0000000102f1068f mini_method_compile + 5503
> 	10  mono                                0x0000000102f158c0 mono_jit_compile_method_inner + 1824
> 	11  mono                                0x0000000102f1ab7c mono_jit_compile_method_with_opt + 1372
> 	12  mono                                0x0000000102f1a60b mono_jit_compile_method + 59
> 	13  mono                                0x0000000103042fce common_call_trampoline_inner + 3086
> 	14  mono                                0x000000010303fa9d common_call_trampoline + 77
> 	15  mono                                0x000000010303f9ff mono_magic_trampoline + 79
> 	16  ???                                 0x00000001037f1298 0x0 + 4353626776
> 	17  ???                                 0x00000001085bc430 0x0 + 4435199024
> 	18  ???                                 0x00000001038dadb9 0x0 + 4354583993
> 	19  mono                                0x0000000102f1da01 mono_jit_runtime_invoke + 2577
> 	20  mono                                0x000000010323df06 do_runtime_invoke + 214
> 	21  mono                                0x0000000103237449 mono_runtime_invoke_checked + 105
> 	22  mono                                0x0000000103240918 mono_runtime_exec_main + 936
> 	23  mono                                0x0000000103240561 mono_runtime_run_main + 913
> 	24  mono                                0x0000000102ff26e3 mono_jit_exec + 387
> 	25  mono                                0x0000000102ff6290 main_thread_handler + 560
> 	26  mono                                0x0000000102ff4c37 mono_main + 8263
> 	27  mono                                0x0000000102f083be mono_main_with_options + 46
> 	28  mono                                0x0000000102f08383 main + 51
> 	29  libdyld.dylib                       0x00007fff948585ad start + 1
> 	30  ???                                 0x0000000000000002 0x0 + 2
> 
> Debug info from gdb:
> 
> "monobt" command installed
> (lldb) command source -s 0 '/tmp/mono-gdb-commands.tGeY7L'
> Executing commands in '/tmp/mono-gdb-commands.tGeY7L'.
> (lldb) process attach --pid 90612
> Process 90612 stopped
> * thread #1: tid = 0xf2969, 0x00007fff923e567e libsystem_kernel.dylib`__wait4 + 10, name = 'tid_50f', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>     frame #0: 0x00007fff923e567e libsystem_kernel.dylib`__wait4 + 10
> libsystem_kernel.dylib`__wait4:
> ->  0x7fff923e567e <+10>: jae    0x7fff923e5688            ; <+20>
>     0x7fff923e5680 <+12>: movq   %rax, %rdi
>     0x7fff923e5683 <+15>: jmp    0x7fff923dfc02            ; cerror
>     0x7fff923e5688 <+20>: retq
> 
> Executable module set to "/tmp/mono-dev/bin/mono".
> Architecture set to: x86_64h-apple-macosx.
> (lldb) thread list
> Process 90612 stopped
> * thread #1: tid = 0xf2969, 0x00007fff923e567e libsystem_kernel.dylib`__wait4 + 10, name = 'tid_50f', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>   thread #2: tid = 0xf296a, 0x00007fff923e4eb2 libsystem_kernel.dylib`__psynch_cvwait + 10
>   thread #3: tid = 0xf296b, 0x00007fff923df3c2 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'tid_1303'
>   thread #4: tid = 0xf296c, 0x00007fff923e56de libsystem_kernel.dylib`__workq_kernreturn + 10
>   thread #5: tid = 0xf296d, 0x00007fff923e5ff6 libsystem_kernel.dylib`kevent_qos + 10, queue = 'com.apple.libdispatch-manager'
>   thread #6: tid = 0xf2972, 0x00007fff923e56de libsystem_kernel.dylib`__workq_kernreturn + 10
>   thread #7: tid = 0xf2974, 0x00007fff923e56de libsystem_kernel.dylib`__workq_kernreturn + 10
> (lldb) thread backtrace all
> warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.
> * thread #1: tid = 0xf2969, 0x00007fff923e567e libsystem_kernel.dylib`__wait4 + 10, name = 'tid_50f', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>   * frame #0: 0x00007fff923e567e libsystem_kernel.dylib`__wait4 + 10
>     frame #1: 0x000000010303ba42 mono`mono_handle_native_sigsegv(signal=6, ctx=0x00007fff5ccf5290, info=0x00007fff5ccf5228) + 626 at mini-exceptions.c:2392
>     frame #2: 0x00000001031122f5 mono`sigabrt_signal_handler(_dummy=6, _info=0x00007fff5ccf5228, context=0x00007fff5ccf5290) + 165 at mini-posix.c:218
>     frame #3: 0x00007fff94929eaa libsystem_platform.dylib`_sigtramp + 26
>     frame #4: 0x00007fff923e5003 libsystem_kernel.dylib`__pthread_kill + 11
>     frame #5: 0x00007fff94ee05c5 libsystem_pthread.dylib`pthread_kill + 90
>     frame #6: 0x00007fff87def6e7 libsystem_c.dylib`abort + 129
>     frame #7: 0x000000010333ed23 mono`monoeg_log_default_handler(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, message="* Assertion: should not be reached at method-to-ir.c:11652\n", unused_data=0x0000000000000000) + 211 at goutput.c:233
>     frame #8: 0x000000010333ec32 mono`monoeg_g_logv(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, format="* Assertion: should not be reached at %s:%d\n", args=0x00007fff5ccf55c0) + 114 at goutput.c:113
>     frame #9: 0x000000010333f034 mono`monoeg_assertion_message(format="* Assertion: should not be reached at %s:%d\n") + 356 at goutput.c:133
>     frame #10: 0x0000000102f5793f mono`mono_method_to_ir(cfg=0x00007ffcb4c9de00, method=0x00007ffcb4ada818, start_bblock=0x00007ffcb4cfbee8, end_bblock=0x00007ffcb4cfc010, return_var=0x0000000000000000, inline_args=0x0000000000000000, inline_offset=0, is_virtual_call=0) + 177679 at method-to-ir.c:11652
>     frame #11: 0x0000000102f1068f mono`mini_method_compile(method=0x00007ffcb4ada818, opts=370239999, domain=0x00007ffcb3d01bc0, flags=JIT_FLAG_RUN_CCTORS, parts=0, aot_method_index=-1) + 5503 at mini.c:3736
>     frame #12: 0x0000000102f158c0 mono`mono_jit_compile_method_inner(method=0x00007ffcb4ada818, target_domain=0x00007ffcb3d01bc0, opt=370239999, error=0x00007fff5ccf79c0) + 1824 at mini.c:4365
>     frame #13: 0x0000000102f1ab7c mono`mono_jit_compile_method_with_opt(method=0x00007ffcb4ada818, opt=370239999, error=0x00007fff5ccf79c0) + 1372 at mini-runtime.c:2060
>     frame #14: 0x0000000102f1a60b mono`mono_jit_compile_method(method=0x00007ffcb4ada818, error=0x00007fff5ccf79c0) + 59 at mini-runtime.c:2104
>     frame #15: 0x0000000103042fce mono`common_call_trampoline_inner(regs=0x00007fff5ccf7a98, code="H\x8b�H\x8bD$PH\x89H\x10H\x83�H\x8b�H��\x16H\x81�, m=0x00007ffcb4ada818, vt=0x0000000000000000, vtable_slot=0x0000000000000000, error=0x00007fff5ccf79c0) + 3086 at mini-trampolines.c:696
>     frame #16: 0x000000010303fa9d mono`common_call_trampoline(regs=0x00007fff5ccf7a98, code="H\x8b�H\x8bD$PH\x89H\x10H\x83�H\x8b�H��\x16H\x81�, m=0x00007ffcb4ada818, vt=0x0000000000000000, vtable_slot=0x0000000000000000, error=0x00007fff5ccf79c0) + 77 at mini-trampolines.c:811
>     frame #17: 0x000000010303f9ff mono`mono_magic_trampoline(regs=0x00007fff5ccf7a98, code="H\x8b�H\x8bD$PH\x89H\x10H\x83�H\x8b�H��\x16H\x81�, arg=0x00007ffcb4ada818, tramp="�H#�\b\x18\xa8\xad\xb4�) + 79 at mini-trampolines.c:829
>     frame #18: 0x00000001037f1298
>     frame #19: 0x00000001085bc430
>     frame #20: 0x00000001038dadb9
>     frame #21: 0x0000000102f1da01 mono`mono_jit_runtime_invoke(method=0x00007ffcb3d03198, obj=0x0000000000000000, params=0x00007fff5ccf84f0, exc=0x0000000000000000, error=0x00007fff5ccf8470) + 2577 at mini-runtime.c:2691
>     frame #22: 0x000000010323df06 mono`do_runtime_invoke(method=0x00007ffcb3d03198, obj=0x0000000000000000, params=0x00007fff5ccf84f0, exc=0x0000000000000000, error=0x00007fff5ccf8470) + 214 at object.c:2898
>     frame #23: 0x0000000103237449 mono`mono_runtime_invoke_checked(method=0x00007ffcb3d03198, obj=0x0000000000000000, params=0x00007fff5ccf84f0, error=0x00007fff5ccf8470) + 105 at object.c:3058
>     frame #24: 0x0000000103240918 mono`mono_runtime_exec_main(method=0x00007ffcb3d03198, args=0x0000000103c00340, exc=0x0000000000000000) + 936 at object.c:4471
>     frame #25: 0x0000000103240561 mono`mono_runtime_run_main(method=0x00007ffcb3d03198, argc=0, argv=0x00007fff5ccf8a20, exc=0x0000000000000000) + 913 at object.c:4050
>     frame #26: 0x0000000102ff26e3 mono`mono_jit_exec(domain=0x00007ffcb3d01bc0, assembly=0x00007ffcb3d18100, argc=1, argv=0x00007fff5ccf8a18) + 387 at driver.c:1034
>     frame #27: 0x0000000102ff6290 mono`main_thread_handler(user_data=0x00007fff5ccf8970) + 560 at driver.c:1094
>     frame #28: 0x0000000102ff4c37 mono`mono_main(argc=2, argv=0x00007fff5ccf8a10) + 8263 at driver.c:2133
>     frame #29: 0x0000000102f083be mono`mono_main_with_options(argc=2, argv=0x00007fff5ccf8a10) + 46 at main.c:20
>     frame #30: 0x0000000102f08383 mono`main(argc=2, argv=0x00007fff5ccf8a10) + 51 at main.c:53
>     frame #31: 0x00007fff948585ad libdyld.dylib`start + 1
> 
>   thread #2: tid = 0xf296a, 0x00007fff923e4eb2 libsystem_kernel.dylib`__psynch_cvwait + 10
>     frame #0: 0x00007fff923e4eb2 libsystem_kernel.dylib`__psynch_cvwait + 10
>     frame #1: 0x00007fff94edf150 libsystem_pthread.dylib`_pthread_cond_wait + 767
>     frame #2: 0x00000001032e70ad mono`mono_os_cond_wait(cond=0x0000000103437db8, mutex=0x0000000103437d78) + 29 at mono-os-mutex.h:105
>     frame #3: 0x00000001032e6b92 mono`thread_func(thread_data=0x0000000000000000) + 114 at sgen-thread-pool.c:118
>     frame #4: 0x00007fff94edec13 libsystem_pthread.dylib`_pthread_body + 131
>     frame #5: 0x00007fff94edeb90 libsystem_pthread.dylib`_pthread_start + 168
>     frame #6: 0x00007fff94edc375 libsystem_pthread.dylib`thread_start + 13
> 
>   thread #3: tid = 0xf296b, 0x00007fff923df3c2 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'tid_1303'
>     frame #0: 0x00007fff923df3c2 libsystem_kernel.dylib`semaphore_wait_trap + 10
>     frame #1: 0x000000010323311a mono`mono_os_sem_wait(sem=0x0000000103429190, flags=MONO_SEM_FLAGS_ALERTABLE) + 26 at mono-os-semaphore.h:72
>     frame #2: 0x0000000103232e4b mono`mono_coop_sem_wait(sem=0x0000000103429190, flags=MONO_SEM_FLAGS_ALERTABLE)
> =================================================================
> 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.
> =================================================================
> 
>  + 43 at mono-coop-semaphore.h:40
>     frame #3: 0x0000000103232ce4 mono`finalizer_thread(unused=0x0000000000000000) + 196 at gc.c:726
>     frame #4: 0x00000001031f8a55 mono`start_wrapper_internal(data=0x00007ffcb3d15da0) + 725 at threads.c:731
>     frame #5: 0x00000001031f8771 mono`start_wrapper(data=0x00007ffcb3d15da0) + 33 at threads.c:778
>     frame #6: 0x000000010333219f mono`inner_start_thread(arg=0x00007fff5ccf81f0) + 575 at mono-threads-posix.c:92
>     frame #7: 0x00007fff94edec13 libsystem_pthread.dylib`_pthread_body + 131
>     frame #8: 0x00007fff94edeb90 libsystem_pthread.dylib`_pthread_start + 168
>     frame #9: 0x00007fff94edc375 libsystem_pthread.dylib`thread_start + 13
> 
>   thread #4: tid = 0xf296c, 0x00007fff923e56de libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #0: 0x00007fff923e56de libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #1: 0x00007fff94ede729 libsystem_pthread.dylib`_pthread_wqthread + 1283
>     frame #2: 0x00007fff94edc365 libsystem_pthread.dylib`start_wqthread + 13
> 
>   thread #5: tid = 0xf296d, 0x00007fff923e5ff6 libsystem_kernel.dylib`kevent_qos + 10, queue = 'com.apple.libdispatch-manager'
>     frame #0: 0x00007fff923e5ff6 libsystem_kernel.dylib`kevent_qos + 10
>     frame #1: 0x00007fff8599b099 libdispatch.dylib`_dispatch_mgr_invoke + 216
>     frame #2: 0x00007fff8599ad01 libdispatch.dylib`_dispatch_mgr_thread + 52
> 
>   thread #6: tid = 0xf2972, 0x00007fff923e56de libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #0: 0x00007fff923e56de libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #1: 0x00007fff94ede729 libsystem_pthread.dylib`_pthread_wqthread + 1283
>     frame #2: 0x00007fff94edc365 libsystem_pthread.dylib`start_wqthread + 13
> 
>   thread #7: tid = 0xf2974, 0x00007fff923e56de libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #0: 0x00007fff923e56de libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #1: 0x00007fff94ede729 libsystem_pthread.dylib`_pthread_wqthread + 1283
>     frame #2: 0x00007fff94edc365 libsystem_pthread.dylib`start_wqthread + 13
> (lldb) detach
> error: Detach failed: Sending disconnect packet failed.
> Killed: 9
Comment 1 Aleksey Kliger 2016-03-18 02:03:14 UTC
Can you tell me what you pass to autogen.sh? I'm having trouble repro-ing with my usual:
    $ CC='ccache cc -m32' CXX='ccache c++ -m32' ./autogen.sh --prefix=${PREFIX} --disable-nls --build=i386-apple-darwin11.2.0 --enable-native-types --enable-llvm --enable-debug
Comment 2 Alexander Köplinger [MSFT] 2016-03-18 02:08:33 UTC
Sorry forgot to mention: I'm using ./autogen.sh --prefix=$PREFIX --disable-nls, so a standard 64bit Mono on OSX.
Comment 3 Aleksey Kliger 2016-03-18 03:11:42 UTC
Not happening here; I wonder if it depends on NuGet.config.  Does it assert consistently for you?

In any case, the 'g_assert_not_reached ()' at method-to-ir.c:11652 seems wrong.  Can you comment it out rebuild and see if that helps?
Comment 4 Alexander Köplinger [MSFT] 2016-03-18 03:27:34 UTC
Yep, happens consistently here. My NuGet.Config in $HOME/.nuget/NuGet is empty <configuration/>.

If I comment out the assert then it seems to work if I run it with "MONO_PATH=<repo>/mcs/class/lib/net_4_x/ <repo>/mono/mini/mono-sgen nuget.exe".

If I install it to my dev prefix and run then it prints:

>The type initializer for 'NuGet.ProxyCache' threw an exception.
>  libc.dylib

That may be a different problem though (likely related to how I set up the parallel environment? I used http://www.mono-project.com/docs/compiling-mono/parallel-mono-environments/#setting-up-a-build-environment), so it seems the bogus asssert is the main problem.
Comment 5 Zoltan Varga 2016-03-19 11:14:39 UTC
Fixed in master. Sorry about that.