Bug 32719 - SIGSEGV in Thread.cs:204
Summary: SIGSEGV in Thread.cs:204
Status: RESOLVED DUPLICATE of bug 30148
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-08-03 13:32 UTC by TheGreatCO
Modified: 2015-10-16 10:16 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 DUPLICATE of bug 30148

Description TheGreatCO 2015-08-03 13:32:14 UTC
This is a multi-threaded application following a pretty standard Producer/Consumer pattern using BlockingCollection<T> and ConcurrentBag<T>. I spin up a reader thread, read lines into a BlockingCollection<T> and several parsing threads dequeue for processing. I follow a similar model with several more producer/consumers in other parts of the program, however this particular section of code crashes every time. There are no async/await calls in my code, however I haven't dug all the way down the stack to be sure. Producer/Consumers are started using "Task.Factory.StartNew" and kept in a list where they are finally Task.WhenAll.

As I mentioned, this model is used in several places in the codebase and only fails in one particular spot. It is possibly related to https://bugzilla.xamarin.com/show_bug.cgi?id=32122, but it isn't identical.

In related news, I cannot test this on Windows because of another Mono bug where CreateZStream is missing on Mono for Windows.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff2bf6700 (LWP 29420)]
System_Threading_Thread_SerializePrincipal_System_Threading_Thread_System_Security_Principal_IPrincipal (th=..., value=...)
    at /home/thegreatco/mono/mcs/class/corlib/System.Threading/Thread.cs:204
204                             if (value.GetType () == typeof (GenericPrincipal)) {
(gdb) thread apply all backtrace

Thread 11 (Thread 0x7ffff06eb700 (LWP 29427)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x0000000000588b0b in worker_park () at threadpool-ms.c:501
#2  worker_thread (data=<optimized out>) at threadpool-ms.c:594
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7ffff29f0770) at mono-threads-posix.c:97
#6  0x00007ffff74b2182 in start_thread (arg=0x7ffff06eb700) at pthread_create.c:312
#7  0x00007ffff71df47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 10 (Thread 0x7ffff18ff700 (LWP 29425)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000005ff4cb in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x420, timeout=timeout@entry=0x0, alertable=alertable@entry=1, poll=poll@entry=0,
    alerted=alerted@entry=0x7ffff18fe45c) at handles.c:1635
#2  0x0000000000610d2c in wapi_WaitForSingleObjectEx (handle=handle@entry=0x420, timeout=timeout@entry=4294967295, alertable=alertable@entry=1) at wait.c:185
#3  0x00000000005a5d06 in ves_icall_System_Threading_Monitor_Monitor_wait (obj=0x7ffff6902310, ms=4294967295) at monitor.c:1104
#4  0x0000000040117738 in ?? ()
#5  0x000000000000000a in ?? ()
#6  0xffffffffffffffff in ?? ()
#7  0x0000000000000000 in ?? ()

Thread 9 (Thread 0x7ffff1eb3700 (LWP 29424)):
#0  0x00007ffff71dfb13 in epoll_wait () at ../sysdeps/unix/syscall-template.S:81
#1  0x000000000058c5c3 in epoll_event_wait () at threadpool-ms-io-epoll.c:90
#2  0x000000000058c1f1 in selector_thread (data=<optimized out>) at threadpool-ms-io.c:345
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7ffff2bf4fb0) at mono-threads-posix.c:97
#6  0x00007ffff74b2182 in start_thread (arg=0x7ffff1eb3700) at pthread_create.c:312
#7  0x00007ffff71df47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 8 (Thread 0x7ffff29f1700 (LWP 29421)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x0000000000588b0b in worker_park () at threadpool-ms.c:501
#2  worker_thread (data=<optimized out>) at threadpool-ms.c:594
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7ffff2bf5770) at mono-threads-posix.c:97
#6  0x00007ffff74b2182 in start_thread (arg=0x7ffff29f1700) at pthread_create.c:312
#7  0x00007ffff71df47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 7 (Thread 0x7ffff2bf6700 (LWP 29420)):
#0  System_Threading_Thread_SerializePrincipal_System_Threading_Thread_System_Security_Principal_IPrincipal (th=..., value=...)
    at /home/thegreatco/mono/mcs/class/corlib/System.Threading/Thread.cs:204
#1  0x00007ffff3ea5920 in System_Threading_Thread_set_CurrentPrincipal_System_Security_Principal_IPrincipal (value=...)
    at /home/thegreatco/mono/mcs/class/corlib/System.Threading/Thread.cs:273
#2  0x000000004017a074 in ?? ()
#3  0xffffffffffffffff in ?? ()
#4  0x00007ffff68f90c8 in ?? ()
#5  0x00007ffff691b200 in ?? ()
#6  0x0000000040178710 in ?? ()
#7  0x00007ffff68fcd00 in ?? ()
#8  0x00007ffff2bf5200 in ?? ()
#9  0x0000000000000001 in ?? ()
#10 0x00007ffff7f2c130 in ?? ()
#11 0x00007ffff691b108 in ?? ()
#12 0x00007ffff691b130 in ?? ()
#13 0x00007ffff691b5b8 in ?? ()
#14 0x00007ffff691b5b8 in ?? ()
#15 0x00007ffff691b280 in ?? ()
#16 0x00007ffff68fd3d8 in ?? ()
#17 0x00007ffff691b428 in ?? ()
#18 0x00007ffff691b428 in ?? ()
#19 0x00007ffff68fd420 in ?? ()
#20 0x00007ffff691b280 in ?? ()
#21 0x00007ffff691b280 in ?? ()
#22 0x00007ffff691b280 in ?? ()
#23 0x00007ffff2bf5200 in ?? ()
#24 0x00000000401778ac in ?? ()
#25 0x00007ffff2bf5220 in ?? ()
#26 0x00007ffff68f90c8 in ?? ()
#27 0x00007ffff691b130 in ?? ()
#28 0x00007ffff68fd3d8 in ?? ()
#29 0x00007ffff7f2c130 in ?? ()
#30 0x00007ffff691b108 in ?? ()
#31 0x00007ffff691b200 in ?? ()
#32 0x00007ffff2bf5370 in ?? ()
#33 0x0000000000000001 in ?? ()
#34 0x00007ffff2bf5370 in ?? ()
#35 0x00007fffcc572790 in ?? ()
#36 0x00007ffff2bf5370 in ?? ()
#37 0x0000000000000000 in ?? ()

Thread 6 (Thread 0x7ffff2c37700 (LWP 29419)):
#0  __clock_nanosleep (clock_id=1, flags=1, req=0x7ffff2c36d90, rem=0xffffffffffffffff) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
#1  0x00000000006120a8 in wapi_SleepEx (ms=ms@entry=100, alertable=alertable@entry=1) at wthreads.c:272
#2  0x0000000000589734 in monitor_thread () at threadpool-ms.c:833
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7fffffffd770) at mono-threads-posix.c:97
#6  0x00007ffff74b2182 in start_thread (arg=0x7ffff2c37700) at pthread_create.c:312
#7  0x00007ffff71df47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 5 (Thread 0x7ffff2e38700 (LWP 29418)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00000000005ff327 in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x40a, timeout=timeout@entry=0x7ffff2e37690, alertable=alertable@entry=1, poll=poll@entry=0,
    alerted=alerted@entry=0x7ffff2e3768c) at handles.c:1633
#2  0x0000000000610d2c in wapi_WaitForSingleObjectEx (handle=0x40a, timeout=timeout@entry=89999, alertable=alertable@entry=1) at wait.c:185
#3  0x0000000000585faf in mono_wait_uninterrupted (thread=thread@entry=0x7ffff7f34f30, multiple=multiple@entry=0, numhandles=numhandles@entry=1, handles=handles@entry=0x7ffff2e37738,
    waitall=waitall@entry=0, ms=ms@entry=89999, alertable=1) at threads.c:1447
#4  0x00000000005874e9 in ves_icall_System_Threading_WaitHandle_WaitOne_internal (this_obj=<optimized out>, handle=0x40a, ms=89999, exitContext=<optimized out>) at threads.c:1581
#5  0x000000004008b0bd in ?? ()
#6  0x0000000000000038 in ?? ()
#7  0x0000000000eaec80 in ?? ()
#8  0x0000000000015f8f in ?? ()
#9  0x00007ffff68caa18 in ?? ()
#10 0x0000000000015f8f in ?? ()
#11 0x00007fffe8000e10 in ?? ()
#12 0x00007ffff68caa18 in ?? ()
#13 0x00007ffff2e377f0 in ?? ()
#14 0x00007ffff2e37760 in ?? ()
#15 0x00007ffff40782ba in System_Threading_WaitHandle_WaitOne_int_bool (this=..., millisecondsTimeout=0, exitContext=false)
    at /home/thegreatco/mono/mcs/class/corlib/System.Threading/WaitHandle.cs:375
#16 0x00007ffff407834c in System_Threading_WaitHandle_WaitOne_int (this=..., millisecondsTimeout=89999) at /home/thegreatco/mono/mcs/class/corlib/System.Threading/WaitHandle.cs:388
#17 0x00007ffff40776db in System_Threading_Timer_Scheduler_SchedulerThread (this=...) at /home/thegreatco/mono/mcs/class/corlib/System.Threading/Timer.cs:395
#18 0x00007ffff3ea3fab in System_Threading_ThreadHelper_ThreadStart_Context_object (state=0x7ffff68c9cc8)
    at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/thread.cs:68
#19 0x00007ffff3e7bb07 in System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool (executionContext=..., callback=...,
    state=0x7ffff68c9cc8, preserveSyncCtx=false) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/executioncontext.cs:581
#20 0x00007ffff3e7b931 in System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool (executionContext=..., callback=...,
    state=0x7ffff68c9cc8, preserveSyncCtx=false) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/executioncontext.cs:530
#21 0x00007ffff3e7b8ba in System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object (executionContext=..., callback=...,
    state=0x7ffff68c9cc8) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/executioncontext.cs:519
#22 0x00007ffff3ea40ff in System_Threading_ThreadHelper_ThreadStart (this=...) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/thread.cs:105
#23 0x000000004001aa79 in ?? ()
#24 0x00000000126e71d6 in ?? ()
#25 0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7ffff1cff700 (LWP 29417)):
#0  __clock_nanosleep (clock_id=1, flags=1, req=0x7ffff1cfe850, rem=0xffffffffffffffff) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
#1  0x00000000006120a8 in wapi_SleepEx (ms=ms@entry=10, alertable=alertable@entry=1) at wthreads.c:272
#2  0x000000000058711a in ves_icall_System_Threading_Thread_Sleep_internal (ms=10) at threads.c:1198
#3  0x000000004004a762 in ?? ()
#4  0x0000000000000001 in ?? ()
#5  0x00007ffff6818518 in ?? ()
#6  0x00007ffff6818340 in ?? ()
#7  0x00007ffff6818340 in ?? ()
#8  0x0000000000000001 in ?? ()
#9  0x00007fffe4000e10 in ?? ()
#10 0x00007ffff1cfe890 in ?? ()
#11 0x00007ffff1cfea30 in ?? ()
#12 0x00007ffff1cfe8a0 in ?? ()
#13 0x00007ffff3ea49a7 in System_Threading_Thread_Sleep_int (millisecondsTimeout=10) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/thread.cs:715
#14 0x000000004001b048 in ?? ()
#15 0x00007fffe4001910 in ?? ()
#16 0x00007ffff1cfea30 in ?? ()
#17 0x00007ffff6818518 in ?? ()
#18 0x00007ffff6818340 in ?? ()
#19 0x00007ffff6818340 in ?? ()
#20 0x00007ffff6818458 in ?? ()
#21 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7ffff3d09700 (LWP 29416)):
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1  0x000000000061d4e7 in mono_sem_wait (sem=sem@entry=0x94cc00 <finalizer_sem>, alertable=alertable@entry=1) at mono-semaphore.c:107
#2  0x00000000005a36b6 in finalizer_thread (unused=<optimized out>) at gc.c:1096
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7fffffffe340) at mono-threads-posix.c:97
#6  0x00007ffff74b2182 in start_thread (arg=0x7ffff3d09700) at pthread_create.c:312
#7  0x00007ffff71df47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 2 (Thread 0x7ffff67ff700 (LWP 29415)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000005fa19c in thread_func (thread_data=0x0) at sgen-thread-pool.c:118
#2  0x00007ffff74b2182 in start_thread (arg=0x7ffff67ff700) at pthread_create.c:312
#3  0x00007ffff71df47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7ffff7fdf7c0 (LWP 29411)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000005ff4cb in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x41d, timeout=timeout@entry=0x0, alertable=alertable@entry=1, poll=poll@entry=0,
    alerted=alerted@entry=0x7fffffffde5c) at handles.c:1635
#2  0x0000000000610d2c in wapi_WaitForSingleObjectEx (handle=handle@entry=0x41d, timeout=timeout@entry=4294967295, alertable=alertable@entry=1) at wait.c:185
#3  0x00000000005a5d06 in ves_icall_System_Threading_Monitor_Monitor_wait (obj=0x7ffff688a528, ms=4294967295) at monitor.c:1104
#4  0x0000000040117738 in ?? ()
#5  0x000000000000000a in ?? ()
#6  0xffffffffffffffff in ?? ()
#7  0x0000000000000000 in ?? ()

~~Environment~~
@shift:~$ mono -V
Mono JIT compiler version 4.3.0 (master/dd36f93 Fri Jul 31 16:20:51 EDT 2015)
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

Compiled from source on Ubuntu
@shift:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:        14.04
Codename:       trusty
Comment 1 TheGreatCO 2015-08-03 14:57:05 UTC
Hopefully this provides some more info.

Stacktrace:


Native stacktrace:

        mono() [0x4a2038]
        mono() [0x4f6ede]
        mono() [0x422d82]
        /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7fbce49f8340]

Debug info from gdb:

Mono support loaded.
[New LWP 29994]
[New LWP 29995]
[New LWP 29993]
[New LWP 29992]
[New LWP 29991]
[New LWP 29990]
[New LWP 29989]
[New LWP 29988]
[New LWP 29987]
[New LWP 29986]
[New LWP 29985]
[New LWP 29984]
[New LWP 29983]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185     ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: No such file or directory.
  Id   Target Id         Frame
  14   Thread 0x7fbce3bff700 (LWP 29983) "mono" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  13   Thread 0x7fbce4359700 (LWP 29984) "Finalizer" sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
  12   Thread 0x7fbcdb4ff700 (LWP 29985) "mono" __clock_nanosleep (clock_id=1, flags=1, req=0x7fbcdb4fe850, rem=0xffffffffffffffff) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
  11   Thread 0x7fbce0698700 (LWP 29986) "Timer-Scheduler" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
  10   Thread 0x7fbce0497700 (LWP 29987) "mono" __clock_nanosleep (clock_id=1, flags=1, req=0x7fbce0496d90, rem=0xffffffffffffffff) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
  9    Thread 0x7fbce0456700 (LWP 29988) "Threadpool work" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
  8    Thread 0x7fbce0255700 (LWP 29989) "Threadpool work" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
  7    Thread 0x7fbce0054700 (LWP 29990) "Threadpool work" 0x00007fbce471db13 in epoll_wait () at ../sysdeps/unix/syscall-template.S:81
  6    Thread 0x7fbcdb0ff700 (LWP 29991) "Threadpool work" 0x00007fbce49f7ee9 in __libc_waitpid (pid=pid@entry=29996, stat_loc=stat_loc@entry=0x7fbce536111c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:40
  5    Thread 0x7fbcda4af700 (LWP 29992) "Threadpool work" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  4    Thread 0x7fbcd97fc700 (LWP 29993) "Threadpool work" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  3    Thread 0x7fbcd8bfd700 (LWP 29995) "Threadpool work" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  2    Thread 0x7fbcd89fc700 (LWP 29994) "Threadpool work" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
* 1    Thread 0x7fbce551f7c0 (LWP 29982) "mono" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185

Thread 14 (Thread 0x7fbce3bff700 (LWP 29983)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000005fa19c in thread_func (thread_data=0x0) at sgen-thread-pool.c:118
#2  0x00007fbce49f0182 in start_thread (arg=0x7fbce3bff700) at pthread_create.c:312
#3  0x00007fbce471d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 13 (Thread 0x7fbce4359700 (LWP 29984)):
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1  0x000000000061d4e7 in mono_sem_wait (sem=sem@entry=0x94cc00 <finalizer_sem>, alertable=alertable@entry=1) at mono-semaphore.c:107
#2  0x00000000005a36b6 in finalizer_thread (unused=<optimized out>) at gc.c:1096
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7ffd029f8690) at mono-threads-posix.c:97
#6  0x00007fbce49f0182 in start_thread (arg=0x7fbce4359700) at pthread_create.c:312
#7  0x00007fbce471d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 12 (Thread 0x7fbcdb4ff700 (LWP 29985)):
#0  __clock_nanosleep (clock_id=1, flags=1, req=0x7fbcdb4fe850, rem=0xffffffffffffffff) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
#1  0x00000000006120a8 in wapi_SleepEx (ms=ms@entry=10, alertable=alertable@entry=1) at wthreads.c:272
#2  0x000000000058711a in ves_icall_System_Threading_Thread_Sleep_internal (ms=10) at threads.c:1198
#3  0x00000000404e6c82 in ?? ()
#4  0x0000000000000001 in ?? ()
#5  0x00007fbce3c18518 in ?? ()
#6  0x00007fbce3c18340 in ?? ()
#7  0x00007fbce3c18340 in ?? ()
#8  0x0000000000000001 in ?? ()
#9  0x00007fbcd4000e10 in ?? ()
#10 0x00007fbcdb4ff698 in ?? ()
#11 0x00007fbcdb4fea30 in ?? ()
#12 0x00007fbcdb4fe8a0 in ?? ()
#13 0x00007fbce12a49a7 in System_Threading_Thread_Sleep_int (millisecondsTimeout=10) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/thread.cs:715
#14 0x00000000404b8048 in ?? ()
#15 0x00007fbcd4001910 in ?? ()
#16 0x00007fbcdb4fea30 in ?? ()
#17 0x00007fbce3c18518 in ?? ()
#18 0x00007fbce3c18340 in ?? ()
#19 0x00007fbce3c18340 in ?? ()
#20 0x00007fbce3c18458 in ?? ()
#21 0x0000000000000000 in ?? ()

Thread 11 (Thread 0x7fbce0698700 (LWP 29986)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00000000005ff327 in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x40a, timeout=timeout@entry=0x7fbce0697690, alertable=alertable@entry=1, poll=poll@entry=0, alerted=alerted@entry=0x7fbce069768c) at handles.c:1633
#2  0x0000000000610d2c in wapi_WaitForSingleObjectEx (handle=0x40a, timeout=timeout@entry=19999, alertable=alertable@entry=1) at wait.c:185
#3  0x0000000000585faf in mono_wait_uninterrupted (thread=thread@entry=0x7fbce5474f30, multiple=multiple@entry=0, numhandles=numhandles@entry=1, handles=handles@entry=0x7fbce0697738, waitall=waitall@entry=0, ms=ms@entry=19999, alertable=1) at threads.c:1447
#4  0x00000000005874e9 in ves_icall_System_Threading_WaitHandle_WaitOne_internal (this_obj=<optimized out>, handle=0x40a, ms=19999, exitContext=<optimized out>) at threads.c:1581
#5  0x000000004052765d in ?? ()
#6  0x0000000000000038 in ?? ()
#7  0x00000000019bb3d0 in ?? ()
#8  0x0000000000004e1f in ?? ()
#9  0x00007fbce3ccb248 in ?? ()
#10 0x0000000000004e1f in ?? ()
#11 0x00007fbccc000e10 in ?? ()
#12 0x00007fbce3ccb248 in ?? ()
#13 0x00007fbce06977f0 in ?? ()
#14 0x00007fbce0697760 in ?? ()
#15 0x00007fbce14782ba in System_Threading_WaitHandle_WaitOne_int_bool (this=..., millisecondsTimeout=0, exitContext=false) at /home/thegreatco/mono/mcs/class/corlib/System.Threading/WaitHandle.cs:375
#16 0x00007fbce147834c in System_Threading_WaitHandle_WaitOne_int (this=..., millisecondsTimeout=19999) at /home/thegreatco/mono/mcs/class/corlib/System.Threading/WaitHandle.cs:388
#17 0x00007fbce14776db in System_Threading_Timer_Scheduler_SchedulerThread (this=...) at /home/thegreatco/mono/mcs/class/corlib/System.Threading/Timer.cs:395
#18 0x00007fbce12a3fab in System_Threading_ThreadHelper_ThreadStart_Context_object (state=%s.%s) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/thread.cs:68
#19 0x00007fbce127bb07 in System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool (executionContext=..., callback=..., state=%s.%s, preserveSyncCtx=false) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/executioncontext.cs:581
#20 0x00007fbce127b931 in System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool (executionContext=..., callback=..., state=%s.%s, preserveSyncCtx=false) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/executioncontext.cs:530
#21 0x00007fbce127b8ba in System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object (executionContext=..., callback=..., state=%s.%s) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/executioncontext.cs:519
#22 0x00007fbce12a40ff in System_Threading_ThreadHelper_ThreadStart (this=...) at /home/thegreatco/mono/external/referencesource/mscorlib/system/threading/thread.cs:105
#23 0x00000000404b7a79 in ?? ()
#24 0x00000000b36a731a in ?? ()
#25 0x0000000000000000 in ?? ()

Thread 10 (Thread 0x7fbce0497700 (LWP 29987)):
#0  __clock_nanosleep (clock_id=1, flags=1, req=0x7fbce0496d90, rem=0xffffffffffffffff) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
#1  0x00000000006120a8 in wapi_SleepEx (ms=ms@entry=100, alertable=alertable@entry=1) at wthreads.c:272
#2  0x0000000000589734 in monitor_thread () at threadpool-ms.c:833
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7ffd029f7ac0) at mono-threads-posix.c:97
#6  0x00007fbce49f0182 in start_thread (arg=0x7fbce0497700) at pthread_create.c:312
#7  0x00007fbce471d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 9 (Thread 0x7fbce0456700 (LWP 29988)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00000000005ff327 in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x4ba, timeout=timeout@entry=0x7fbce0455260, alertable=alertable@entry=1, poll=poll@entry=0, alerted=alerted@entry=0x7fbce045525c) at handles.c:1633
#2  0x0000000000610d2c in wapi_WaitForSingleObjectEx (handle=handle@entry=0x4ba, timeout=timeout@entry=5, alertable=alertable@entry=1) at wait.c:185
#3  0x00000000005a5d06 in ves_icall_System_Threading_Monitor_Monitor_wait (obj=0x7fbce5432590, ms=5) at monitor.c:1104
#4  0x00000000405b4468 in ?? ()
#5  0x0000000000000000 in ?? ()

Thread 8 (Thread 0x7fbce0255700 (LWP 29989)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00000000005ff327 in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x4b9, timeout=timeout@entry=0x7fbce0254260, alertable=alertable@entry=1, poll=poll@entry=0, alerted=alerted@entry=0x7fbce025425c) at handles.c:1633
#2  0x0000000000610d2c in wapi_WaitForSingleObjectEx (handle=handle@entry=0x4b9, timeout=timeout@entry=5, alertable=alertable@entry=1) at wait.c:185
#3  0x00000000005a5d06 in ves_icall_System_Threading_Monitor_Monitor_wait (obj=0x7fbce54325b0, ms=5) at monitor.c:1104
#4  0x00000000405b4468 in ?? ()
#5  0x0000000000000000 in ?? ()

Thread 7 (Thread 0x7fbce0054700 (LWP 29990)):
#0  0x00007fbce471db13 in epoll_wait () at ../sysdeps/unix/syscall-template.S:81
#1  0x000000000058c5c3 in epoll_event_wait () at threadpool-ms-io-epoll.c:90
#2  0x000000000058c1f1 in selector_thread (data=<optimized out>) at threadpool-ms-io.c:345
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7fbce0454fb0) at mono-threads-posix.c:97
#6  0x00007fbce49f0182 in start_thread (arg=0x7fbce0054700) at pthread_create.c:312
#7  0x00007fbce471d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 6 (Thread 0x7fbcdb0ff700 (LWP 29991)):
#0  0x00007fbce49f7ee9 in __libc_waitpid (pid=pid@entry=29996, stat_loc=stat_loc@entry=0x7fbce536111c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:40
#1  0x00000000004a20fe in mono_handle_native_sigsegv (signal=signal@entry=11, ctx=ctx@entry=0x7fbce5361ac0, info=info@entry=0x7fbce5361bf0) at mini-exceptions.c:2243
#2  0x00000000004f6ede in mono_arch_handle_altstack_exception (sigctx=sigctx@entry=0x7fbce5361ac0, siginfo=siginfo@entry=0x7fbce5361bf0, fault_addr=<optimized out>, stack_ovf=stack_ovf@entry=0) at exceptions-amd64.c:808
#3  0x0000000000422d82 in mono_sigsegv_signal_handler (_dummy=11, _info=0x7fbce5361bf0, context=0x7fbce5361ac0) at mini-runtime.c:2466
#4  <signal handler called>
#5  0x0000000000000000 in ?? ()
#6  0x00007fbce11c1774 in System_IO_StreamReader_ReadBuffer (this=...) at /home/thegreatco/mono/external/referencesource/mscorlib/system/io/streamreader.cs:621
#7  0x00007fbce11c2284 in System_IO_StreamReader_ReadLine (this=...) at /home/thegreatco/mono/external/referencesource/mscorlib/system/io/streamreader.cs:804
#8  0x000000004066d80b in ?? ()
#9  0x00007fbce3cd51a8 in ?? ()
#10 0x00007fbce3c3e8f0 in ?? ()
#11 0x00000000015a5188 in ?? ()
#12 0x00007fbce3c3e8f0 in ?? ()
#13 0x00007fbce3c3e8f0 in ?? ()
#14 0x00007fbcdb0fe701 in ?? ()
#15 0x00007fbce3c40900 in ?? ()
#16 0x00007fbce3c40801 in ?? ()
#17 0x00007fbce3cd72e8 in ?? ()
#18 0x00007fbce3cd51a8 in ?? ()
#19 0x00007fbce3c9d3e0 in ?? ()
#20 0x00007fbce3c7a6f8 in ?? ()
#21 0x00007fbce3c7a450 in ?? ()
#22 0x48d29c308cf9c2dc in ?? ()
#23 0x48d29c308703e1dc in ?? ()
#24 0x00007fbce3c3e8f0 in ?? ()
#25 0x00007fbce3c3e8f0 in ?? ()
#26 0x48d29c308870cfda in ?? ()
#27 0x48d29c308cf9c2dc in ?? ()
#28 0x00007fbce3c3e8f0 in ?? ()
#29 0x00007fbce3c3e8f0 in ?? ()
#30 0x48d29c308870cfda in ?? ()
#31 0xffffffffffffff00 in ?? ()
#32 0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7fbcda4af700 (LWP 29992)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000005ff4cb in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x422, timeout=timeout@entry=0x0, alertable=alertable@entry=1, poll=poll@entry=0, alerted=alerted@entry=0x7fbcda4ae45c) at handles.c:1635
#2  0x0000000000610d2c in wapi_WaitForSingleObjectEx (handle=handle@entry=0x422, timeout=timeout@entry=4294967295, alertable=alertable@entry=1) at wait.c:185
#3  0x00000000005a5d06 in ves_icall_System_Threading_Monitor_Monitor_wait (obj=0x7fbce3d04258, ms=4294967295) at monitor.c:1104
#4  0x00000000405b4468 in ?? ()
#5  0x000000000000000a in ?? ()
#6  0xffffffffffffffff in ?? ()
#7  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7fbcd97fc700 (LWP 29993)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000005ff4cb in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x435, timeout=timeout@entry=0x0, alertable=alertable@entry=1, poll=poll@entry=0, alerted=alerted@entry=0x7fbcd97fb3ac) at handles.c:1635
#2  0x0000000000610d2c in wapi_WaitForSingleObjectEx (handle=handle@entry=0x435, timeout=timeout@entry=4294967295, alertable=alertable@entry=1) at wait.c:185
#3  0x00000000005a5d06 in ves_icall_System_Threading_Monitor_Monitor_wait (obj=0x7fbce3c40de8, ms=4294967295) at monitor.c:1104
#4  0x00000000405b4468 in ?? ()
#5  0x000000000000000a in ?? ()
#6  0xffffffffffffffff in ?? ()
#7  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7fbcd8bfd700 (LWP 29995)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x0000000000588b0b in worker_park () at threadpool-ms.c:501
#2  worker_thread (data=<optimized out>) at threadpool-ms.c:594
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7fbce0254770) at mono-threads-posix.c:97
#6  0x00007fbce49f0182 in start_thread (arg=0x7fbcd8bfd700) at pthread_create.c:312
#7  0x00007fbce471d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 2 (Thread 0x7fbcd89fc700 (LWP 29994)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x0000000000588b0b in worker_park () at threadpool-ms.c:501
#2  worker_thread (data=<optimized out>) at threadpool-ms.c:594
#3  0x000000000058612b in start_wrapper_internal (data=<optimized out>) at threads.c:723
#4  start_wrapper (data=<optimized out>) at threads.c:770
#5  0x0000000000624026 in inner_start_thread (arg=0x7fbce0455770) at mono-threads-posix.c:97
#6  0x00007fbce49f0182 in start_thread (arg=0x7fbcd89fc700) at pthread_create.c:312
#7  0x00007fbce471d47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7fbce551f7c0 (LWP 29982)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000005ff4cb in _wapi_handle_timedwait_signal_handle (handle=handle@entry=0x41f, timeout=timeout@entry=0x0, alertable=alertable@entry=1, poll=poll@entry=0, alerted=alerted@entry=0x7ffd029f81ac) at handles.c:1635
#2  0x0000000000610d2c in wapi_WaitForSingleObjectEx (handle=handle@entry=0x41f, timeout=timeout@entry=4294967295, alertable=alertable@entry=1) at wait.c:185
#3  0x00000000005a5d06 in ves_icall_System_Threading_Monitor_Monitor_wait (obj=0x7fbce3c88d18, ms=4294967295) at monitor.c:1104
#4  0x00000000405b4468 in ?? ()
#5  0x000000000000000a in ?? ()
#6  0xffffffffffffffff in ?? ()
#7  0x0000000000000000 in ?? ()

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

Aborted (core dumped)
Comment 2 TheGreatCO 2015-08-14 11:41:15 UTC
OK, so I have done a bit to narrow this down. It seems if I run this particular bit of code wrapped inside a Task.Factory.StartNew, it triggers this segfault. If I don't invoke a new task, the code runs successfully.
Comment 3 xamarin 2015-09-05 06:02:01 UTC
Looks like the same issue as Bug 30148. Did you try using boehm gc?
Comment 4 TheGreatCO 2015-10-16 10:16:31 UTC
It appears that switching to boehm fixes the problem. Thanks for pointing that out. I will follow 30148 for progress on the fix.

*** This bug has been marked as a duplicate of bug 30148 ***