Bug 14926 - 3.2.3 Runtime crashes (Nuget 2.7)
Summary: 3.2.3 Runtime crashes (Nuget 2.7)
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-09-23 09:40 UTC by Urs Keller
Modified: 2013-12-03 17:41 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 Urs Keller 2013-09-23 09:40:11 UTC
gmcs --version
3.2.3.0
mono --version
Mono JIT compiler version 3.2.3 ((no/8d3b4b7 Mon Sep 16 23:46:28 EDT 2013)

I recently switched from the Stable to the Alpha channel and back, this updated Mono to 3.2.3 from 3.2.0, I now get this weird crash with Nuget, see below. This didn't happen in the previous stable version.

Gmcs   Mono   Result
3.2.0  3.2.0  OK
3.2.0  3.2.3  OK
3.2.3  3.2.0  CRASH
3.2.3  3.2.3  CRASH

Arguably this is a bug in the compiler, but the Mono runtime shouldn't crash!

Steps to reproduce:

git clone https://git01.codeplex.com/nuget nuget.test
cd nuget.test
git checkout 2.7
export P=Debug; rm -rf cmdline/; mkdir cmdline;  pushd src/Core;xbuild /p:Configuration=$P; popd ; pushd src/CommandLine;xbuild /p:Configuration=$P; popd; cp ./src/Core/bin/$P/*.dll ./src/CommandLine/bin/$P/*.exe cmdline/
cd cmdline/
mono NuGet.exe list


Expect behaviour:
- Mono doesn't crash and list of nuget packages

Current behaviour:
- Mono crashes



* Assertion at class.c:2226, condition `method->klass == gklass' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at NuGet.AggregateQuery`1/<ReadOrderedQueues>c__IteratorF/<ReadOrderedQueues>c__AnonStorey36.<>m__7C () <0x0001b>
  at System.Threading.Tasks.TaskActionInvoker/FuncInvoke`1.Invoke (System.Threading.Tasks.Task,object,System.Threading.Tasks.Task) <0x00041>
  at System.Threading.Tasks.Task.InnerInvoke () <0x00046>
  at System.Threading.Tasks.Task.ThreadStart () <0x00203>
  at System.Threading.Tasks.Task.Execute () <0x00013>
  at System.Threading.Tasks.TpScheduler.TaskExecuterCallback (object) <0x00033>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	0   mono                                0x001147f4 mono_handle_native_sigsegv + 292
	1   mono                                0x0016a9cd sigabrt_signal_handler + 109
	2   libsystem_c.dylib                   0x95a3794b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   libsystem_c.dylib                   0x95a83631 abort + 168
	5   mono                                0x002bd9cc monoeg_g_logv + 188
	6   mono                                0x002bd9fb monoeg_assertion_message + 43
	7   mono                                0x00184271 mono_class_get_inflated_method + 321
	8   mono                                0x001221a5 mono_class_get_method_generic + 53
	9   mono                                0x0011989a common_call_trampoline + 938
	10  mono                                0x00116a6b mono_magic_trampoline + 59
	11  ???                                 0x004a603e 0x0 + 4874302
	12  ???                                 0x030b81a2 0x0 + 51085730
	13  ???                                 0x030b8157 0x0 + 51085655
	14  ???                                 0x030b7b84 0x0 + 51084164
	15  ???                                 0x030b74dc 0x0 + 51082460
	16  ???                                 0x030b746c 0x0 + 51082348
	17  ???                                 0x00633d9d 0x0 + 6503837
	18  mono                                0x000794ee mono_jit_runtime_invoke + 798
	19  mono                                0x0023304e mono_runtime_invoke + 126
	20  mono                                0x002331bc mono_runtime_delegate_invoke + 140
	21  mono                                0x0020a7f5 async_invoke_thread + 2165
	22  mono                                0x00203474 start_wrapper + 468
	23  mono                                0x002a8eca thread_start_routine + 154
	24  mono                                0x002b9411 inner_start_thread + 65
	25  libsystem_c.dylib                   0x95a4b5b7 _pthread_start + 344
	26  libsystem_c.dylib                   0x95a35dce thread_start + 34

Debug info from gdb:

Attaching to process 4144.
Reading symbols for shared libraries . done
Reading symbols for shared libraries ............................................... done
Reading symbols for shared libraries + done
0x921078e2 in __psynch_cvwait ()
  12                                 0x92105822 in semaphore_timedwait_trap ()
  11                                 0x9210809a in __wait4 ()
  10                                 0x92105822 in semaphore_timedwait_trap ()
   9                                 0x92107be6 in select$DARWIN_EXTSN ()
   8                                 0x92105822 in semaphore_timedwait_trap ()
   7                                 0x92107c72 in __semwait_signal ()
   6                                 0x921078e2 in __psynch_cvwait ()
   5                                 0x921080ee in __workq_kernreturn ()
   4 "com.apple.libdispatch-manager" 0x921089ae in kevent ()
   3                                 0x921080ee in __workq_kernreturn ()
   2                                 0x9210580a in semaphore_wait_trap ()
*  1 "com.apple.main-thread"         0x921078e2 in __psynch_cvwait ()

Thread 12 (process 4144):
#0  0x92105822 in semaphore_timedwait_trap ()
#1  0x002b48f5 in mono_sem_timedwait (sem=0x3b7188, timeout_ms=2000, alertable=1) at mono-semaphore.c:79
#2  0x0020ab2e in async_invoke_thread (data=0x0) at threadpool.c:1565
#3  0x00203474 in start_wrapper_internal [inlined] () at :608
#4  0x00203474 in start_wrapper (data=0x7aa856a0) at threads.c:653
#5  0x002a8eca in thread_start_routine (args=0x7a1235f4) at wthreads.c:294
#6  0x002b9411 in inner_start_thread (arg=0x7aa84ab0) at mono-threads-posix.c:49
#7  0x95a4b5b7 in _pthread_start ()
#8  0x95a35dce in thread_start ()

Thread 11 (process 4144):
#0  0x9210809a in __wait4 ()
#1  0x95ad598a in waitpid$UNIX2003 ()
#2  0x001148c2 in mono_handle_native_sigsegv (signal=6, ctx=0xb05f291c) at mini-exceptions.c:2344
#3  0x0016a9cd in sigabrt_signal_handler (_dummy=6, info=0xb05f28dc, context=0xb05f291c) at mini-posix.c:206
#4  <signal handler called>
#5  0x92107a6a in __pthread_kill ()
#6  0x95a4cb2f in pthread_kill ()
#7  0x95a83631 in abort ()
#8  0x002bd9cc in monoeg_g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_ERROR, format=0x2dbd2c "* Assertion at %s:%d, condition `%s' not met\n", args=0xb05f29e4 "\026?-") at goutput.c:175
#9  0x002bd9fb in monoeg_assertion_message (format=0x2dbd2c "* Assertion at %s:%d, condition `%s' not met\n") at goutput.c:195
#10 0x00184271 in mono_class_get_inflated_method (class=0x7b4f47e4, method=0x7b3950c4) at class.c:2226
#11 0x001221a5 in mono_class_get_method_generic (klass=0x7b4f47e4, method=0x7aa0e0f0) at mini-generic-sharing.c:483
#12 0x0011989a in common_call_trampoline ()
#13 0x00116a6b in mono_magic_trampoline (regs=0xb05f2bb8, code=0x30b8344 "??\020??", arg=0x7aa0e0f0, tramp=0x0) at mini-trampolines.c:691
#14 0x004a603e in ?? ()
#15 0x030b81a2 in ?? ()
#16 0x030b8157 in ?? ()
#17 0x030b7b84 in ?? ()
#18 0x030b74dc in ?? ()
#19 0x030b746c in ?? ()
#20 0x00633d9d in ?? ()
#21 0x000794ee in mono_jit_runtime_invoke (method=0x7b37139c, obj=0xabcac8, params=0xb05f2eec, exc=0xb05f2ef4) at mini.c:6473
#22 0x0023304e in mono_runtime_invoke (method=0x7b37139c, obj=0xabcac8, params=0xb05f2eec, exc=0xb05f2ef4) at object.c:2827
#23 0x002331bc in mono_runtime_delegate_invoke (delegate=0xabcac8, params=0xb05f2eec, exc=0xb05f2ef4) at object.c:3538
#24 0x0020a7f5 in mono_async_invoke [inlined] () at :621
#25 0x0020a7f5 in async_invoke_thread (data=0xabe0d8) at threadpool.c:1517
#26 0x00203474 in start_wrapper_internal [inlined] () at :608
#27 0x00203474 in start_wrapper (data=0x7aa826c0) at threads.c:653
#28 0x002a8eca in thread_start_routine (args=0x7a1234fc) at wthreads.c:294
#29 0x002b9411 in inner_start_thread (arg=0x7aa83250) at mono-threads-posix.c:49
#30 0x95a4b5b7 in _pthread_start ()
#31 0x95a35dce in thread_start ()

Thread 10 (process 4144):
#0  0x92105822 in semaphore_timedwait_trap ()
#1  0x002b48f5 in mono_sem_timedwait (sem=0x3b7208, timeout_ms=2000, alertable=1) at mono-semaphore.c:79
#2  0x0020ab2e in async_invoke_thread (data=0x0) at threadpool.c:1565
#3  0x00203474 in start_wrapper_internal [inlined] () at :608
#4  0x00203474 in start_wrapper (data=0x7aa83740) at threads.c:653
#5  0x002a8eca in thread_start_routine (args=0x7a123404) at wthreads.c:294
#6  0x002b9411 in inner_start_thread (arg=0x7aa82820) at mono-threads-posix.c:49
#7  0x95a4b5b7 in _pthread_start ()
#8  0x95a35dce in thread_start ()

Thread 9 (process 4144):
#0  0x92107be6 in select$DARWIN_EXTSN ()
#1  0x002b432f in mono_poll (ufds=0x7b414a00, nfds=1, timeout=-1) at mono-poll.c:76
#2  0x00208fd8 in tp_poll_wait (p=0x3b72a0) at tpool-poll.c:186
#3  0x00203474 in start_wrapper_internal [inlined] () at :608
#4  0x00203474 in start_wrapper (data=0x7aa83a00) at threads.c:653
#5  0x002a8eca in thread_start_routine (args=0x7a123388) at wthreads.c:294
#6  0x002b9411 in inner_start_thread (arg=0x7aa83740) at mono-threads-posix.c:49
#7  0x95a4b5b7 in _pthread_start ()
#8  0x95a35dce in thread_start ()

Thread 8 (process 4144):
#0  0x92105822 in semaphore_timedwait_trap ()
#1  0x002b48f5 in mono_sem_timedwait (sem=0x3b7188, timeout_ms=2000, alertable=1) at mono-semaphore.c:79
#2  0x0020ab2e in async_invoke_thread (data=0x0) at threadpool.c:1565
#3  0x00203474 in start_wrapper_internal [inlined] () at :608
#4  0x00203474 in start_wrapper (data=0x7aa73de0) at threads.c:653
#5  0x002a8eca in thread_start_routine (args=0x7a12311c) at wthreads.c:294
#6  0x002b9411 in inner_start_thread (arg=0x7aa73bd0) at mono-threads-posix.c:49
#7  0x95a4b5b7 in _pthread_start ()
#8  0x95a35dce in thread_start ()

Thread 7 (process 4144):
#0  0x92107c72 in __semwait_signal ()
#1  0x95ad5a49 in nanosleep$UNIX2003 ()
#2  0x002a8135 in SleepEx (ms=500, alertable=1) at wthreads.c:842
#3  0x00208078 in monitor_thread (unused=0x0) at threadpool.c:779
#4  0x00203474 in start_wrapper_internal [inlined] () at :608
#5  0x00203474 in start_wrapper (data=0x7aa73920) at threads.c:653
#6  0x002a8eca in thread_start_routine (args=0x7a1230a0) at wthreads.c:294
#7  0x002b9411 in inner_start_thread (arg=0x7aa73de0) at mono-threads-posix.c:49
#8  0x95a4b5b7 in _pthread_start ()
#9  0x95a35dce in thread_start ()

Thread 6 (process 4144):
#0  0x921078e2 in __psynch_cvwait ()
#1  0x95a50280 in _pthread_cond_wait ()
#2  0x95ad60d4 in pthread_cond_timedwait$UNIX2003 ()
#3  0x00292b84 in timedwait_signal_poll_cond [inlined] () at :1493
#4  0x00292b84 in _wapi_handle_timedwait_signal_handle (handle=0x108, timeout=0xb0388be0, alertable=1, poll=0) at handles.c:1583
#5  0x002a5f44 in WaitForSingleObjectEx (handle=0x131, timeout=9997, alertable=1) at wait.c:198
#6  0x0020619a in mono_wait_uninterrupted () at atomic.h:56
#7  0x0020625f in ves_icall_System_Threading_WaitHandle_WaitOne_internal (handle=0x108, this=0x9202d8, ms=9997, exitContext=0) at threads.c:1622
#8  0x01b357a4 in ?? ()
#9  0x01b353c0 in ?? ()
#10 0x01b35181 in ?? ()
#11 0x01b2549c in ?? ()
#12 0x01b23fa0 in ?? ()
#13 0x00641485 in ?? ()
#14 0x000794ee in mono_jit_runtime_invoke (method=0x7b367464, obj=0x9203c0, params=0xb0388f34, exc=0x0) at mini.c:6473
#15 0x0023304e in mono_runtime_invoke (method=0x7b367464, obj=0x9203c0, params=0xb0388f34, exc=0x0) at object.c:2827
#16 0x002331bc in mono_runtime_delegate_invoke (delegate=0x9203c0, params=0xb0388f34, exc=0x0) at object.c:3538
#17 0x002034a0 in start_wrapper_internal [inlined] () at :614
#18 0x002034a0 in start_wrapper (data=0x7aa46010) at threads.c:653
#19 0x002a8eca in thread_start_routine (args=0x7a122f2c) at wthreads.c:294
#20 0x002b9411 in inner_start_thread (arg=0x7aa46460) at mono-threads-posix.c:49
#21 0x95a4b5b7 in _pthread_start ()
#22 0x95a35dce in thread_start ()

Thread 5 (process 4144):
#0  0x921080ee in __workq_kernreturn ()
#1  0x95a4e0ac in _pthread_workq_return ()
#2  0x95a4de79 in _pthread_wqthread ()
#3  0x95a35daa in start_wqthread ()

Thread 4 (process 4144):
#0  0x921089ae in kevent ()
#1  0x96022c71 in _dispatch_mgr_invoke ()
#2  0x960227a9 in _dispatch_mgr_thread ()

Thread 3 (process 4144):
#0  0x921080ee in __workq_kernreturn ()
#1  0x95a4e0ac in _pthread_workq_return ()
#2  0x95a4de79 in _pthread_wqthread ()
#3  0x95a35daa in start_wqthread ()

Thread 2 (process 4144):
#0  0x9210580a in semaphore_wait_trap ()
#1  0x002b496e in mono_sem_wait (sem=Cannot access memory at address 0x0
) at mono-semaphore.c:118
#2  0x0022c99a in finalizer_thread (unused=0x0) at gc.c:1073
#3  0x00203474 in start_wrapper_internal [inlined] () at :608
#4  0x00203474 in start_wrapper (data=0x79e5afc0) at threads.c:653
#5  0x002a8eca in thread_start_routine (args=0x7a122db8) at wthreads.c:294
#6  0x002b9411 in inner_start_thread (arg=0x79e5b0a0) at mono-threads-posix.c:49
#7  0x95a4b5b7 in _pthread_start ()
#8  0x95a35dce in thread_start ()

Thread 1 (process 4144):
#0  0x921078e2 in __psynch_cvwait ()
#1  0x95a50280 in _pthread_cond_wait ()
#2  0x95ad6089 in pthread_cond_wait$UNIX2003 ()
#3  0x00292bec in _wapi_handle_timedwait_signal_handle (handle=0x134, timeout=0x0, alertable=1, poll=0) at handles.c:1588
#4  0x00292c38 in _wapi_handle_wait_signal_handle (handle=0x134, alertable=1) at handles.c:1533
#5  0x002a5f21 in WaitForSingleObjectEx (handle=0x104, timeout=4294967295, alertable=1) at wait.c:196
#6  0x0020619a in mono_wait_uninterrupted () at atomic.h:56
#7  0x0020625f in ves_icall_System_Threading_WaitHandle_WaitOne_internal (handle=0x134, this=0xabe198, ms=-1, exitContext=0) at threads.c:1622
#8  0x01b357a4 in ?? ()
#9  0x01b353c0 in ?? ()
#10 0x030b8510 in ?? ()
#11 0x030b8378 in ?? ()
#12 0x030b7618 in ?? ()
#13 0x030b74b0 in ?? ()
#14 0x030b5008 in ?? ()
#15 0x01af2da2 in ?? ()
#16 0x01af2da2 in ?? ()
#17 0x03091d46 in ?? ()
#18 0x01b14a88 in ?? ()
#19 0x01af5988 in ?? ()
#20 0x006368b8 in ?? ()
#21 0x00636c9a in ?? ()
#22 0x000794ee in mono_jit_runtime_invoke (method=0x7a0f981c, obj=0x0, params=0xbff948f8, exc=0x0) at mini.c:6473
#23 0x0023304e in mono_runtime_invoke (method=0x7a0f981c, obj=0x0, params=0xbff948f8, exc=0x0) at object.c:2827
#24 0x00237604 in mono_runtime_exec_main (method=0x7a0f981c, args=0x800798, exc=0x0) at object.c:4054
#25 0x00237975 in mono_runtime_run_main (method=0x7a0f981c, argc=0, argv=0xbff94b00, exc=0x0) at object.c:3678
#26 0x000e4a25 in mono_jit_exec (domain=0x79e43900, assembly=0x7a837f80, argc=2, argv=0xbff94b00) at driver.c:960
#27 0x000e6f7f in mono_main (argc=3, argv=0xbff94afc) at driver.c:1019
#28 0x0006cbfe in main (argc=3, argv=0xbff94afc) at main.c:94

=================================================================
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.
=================================================================

Abort trap: 6
Comment 1 Zoltan Varga 2013-09-25 05:46:51 UTC
This looks like an mcs bug, PEVerify reports for NuGet.Core.dll:

[IL]: Error: [y:\NuGet.Core.dll : NuGet.AggregateQuery`1+<ReadOrderedQueues>c__IteratorF[TVal]::<>m__7B][offset 0x0000000F][found ref ('this' ptr) 'NuGet.AggregateQuery`1+<ReadOrderedQueues>c__IteratorF[TVal]'][expected ref 'NuGet.AggregateQuery`1[TVal]'] Unexpected type on the stack.
Comment 2 Zoltan Varga 2013-09-25 10:41:11 UTC
-> mcs.
Comment 3 Marek Safar 2013-09-29 17:58:41 UTC
Fixed in master
Comment 4 Brian Reiter 2013-12-03 17:31:50 UTC
I just experienced this issue using the official 3.2.5 build from Xamarin on Mavericks. I can't find a commit that relates to #14926 on or around Sept 29 2013. Did this fix ever get pushed?

[master] $ gmcs --version
Mono C# compiler version 3.2.5.0
[master] $ mono --version
Mono JIT compiler version 3.2.5 ((no/964e8f0 Thu Nov 14 14:48:50 EST 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.3svn-mono)
	GC:            sgen


[master] $ mono NuGet.exe list
* Assertion at class.c:2226, condition `method->klass == gklass' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at NuGet.AggregateQuery`1/<ReadOrderedQueues>c__IteratorF/<ReadOrderedQueues>c__AnonStorey38.<>m__76 () <0x0001b>
  at System.Threading.Tasks.TaskActionInvoker/FuncInvoke`1.Invoke (System.Threading.Tasks.Task,object,System.Threading.Tasks.Task) <0x00041>
  at System.Threading.Tasks.Task.InnerInvoke () <0x00046>
  at System.Threading.Tasks.Task.ThreadStart () <0x00203>
  at System.Threading.Tasks.Task.Execute () <0x00013>
  at System.Threading.Tasks.TpScheduler.TaskExecuterCallback (object) <0x00033>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	0   mono                                0x0019a7d4 mono_handle_native_sigsegv + 292
	1   mono                                0x001f09ad sigabrt_signal_handler + 109
	2   libsystem_platform.dylib            0x948aadeb _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   libsystem_c.dylib                   0x97835340 abort + 155
	5   mono                                0x003439cc monoeg_g_logv + 188
	6   mono                                0x003439fb monoeg_assertion_message + 43
	7   mono                                0x0020a251 mono_class_get_inflated_method + 321
	8   mono                                0x001a8185 mono_class_get_method_generic + 53
	9   mono                                0x0019f87a common_call_trampoline + 938
	10  mono                                0x0019ca4b mono_magic_trampoline + 59
	11  ???                                 0x0052d03e 0x0 + 5427262
	12  ???                                 0x0265bac2 0x0 + 40221378
	13  ???                                 0x0265ba77 0x0 + 40221303
	14  ???                                 0x0265b4a4 0x0 + 40219812
	15  ???                                 0x0265adfc 0x0 + 40218108
	16  ???                                 0x0265ad8c 0x0 + 40217996
	17  ???                                 0x006afd9d 0x0 + 7011741
	18  mono                                0x000ff4ce mono_jit_runtime_invoke + 798
	19  mono                                0x002b904e mono_runtime_invoke + 126
	20  mono                                0x002b91bc mono_runtime_delegate_invoke + 140
	21  mono                                0x002907f5 async_invoke_thread + 2165
	22  mono                                0x00289454 start_wrapper + 468
	23  mono                                0x0032eeca thread_start_routine + 154
	24  mono                                0x0033f411 inner_start_thread + 65
	25  libsystem_pthread.dylib             0x9a1ac5fb _pthread_body + 144
	26  libsystem_pthread.dylib             0x9a1ac485 _pthread_struct_init + 0
	27  libsystem_pthread.dylib             0x9a1b1cf2 thread_start + 34

Debug info from gdb:

/tmp/mono-gdb-commands.DJYKaB:1: Error in sourced command file:
Unable to access task for process-id 25106: (os/kern) failure.

=================================================================
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.
=================================================================

Abort trap: 6
Comment 5 Brian Reiter 2013-12-03 17:41:21 UTC
Ok, sorry. I found it. 

https://github.com/mono/mono/commit/3912066fe1134ba665770723a24c8ea9b4f1aea3

The changes aren't in 3.2.5 but are in the 3.2.6 branch.