Created attachment 15054 [details]
The C# code to reproduce the error
I've come across this bug in mono 2.11.4, 3.2.1 and 3.12.1.
Whenever Console.ReadLine() is executed in a background thread while the application is exiting, segmentation faults can occur.
I've made a bash loop script to try it out multiple times since the segfault doesn't seem to occur every time.
Sometimes it takes 500 attempts and sometimes only 5.
The code can be compiled with mcs or in visual studio with .net, both generate the error.
Created attachment 15055 [details]
Bash loop script
Added bash loop script for testing.
No longer reproducible with 4.2 or HEAD on Debian x64 or OSX after ~1500 iterations.
I can reproduce the segfault on Mono 3.12, Mono 4.0 and Mono 4.2 using the Mono Docker images and with 4.2 on the Ubuntu 14.04 x64 host VM (though it took about ~2500 iterations there).
I was also able to repro it using master/f558ee9 too so the bug is definitely still there.
I've attached a stack trace from the core dump of the master build and assigning to Aleksey since you already took a look earlier, please feel to reassign to someone more appropriate :)
Created attachment 15123 [details]
gdb log from core dump
We have changed how threads are stopped so this might be fixed with latest version of Mono. Can you still reproduce with Mono 184.108.40.206 (2017-06/6425f06) or later? Thank you
Please reopen if you can still reproduce. Thank you