Bug 12786 - Crash on mono 3.x running xunit tests - Assertion at mini-generic-sharing.c:285, condition `subclass->image == image' not met
Summary: Crash on mono 3.x running xunit tests - Assertion at mini-generic-sharing.c:2...
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
: 11216 ()
Depends on:
Reported: 2013-06-20 07:47 UTC by Steven Robbins
Modified: 2013-08-23 15:40 UTC (History)
5 users (show)

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

Simple repro case (757.24 KB, application/octet-stream)
2013-06-20 07:48 UTC, Steven Robbins

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:

Description Steven Robbins 2013-06-20 07:47:36 UTC
Recent builds, up to and including 3.0.12, are crashing when running xunit. The crash doesn't seem to be specific to the test (it seems to be random), but certain assemblies cause it more than others so I'm guessing some kind of race condition is at work.

I've attached a file with a simple repro - just extract it and run go.sh and it will run the xunit commandline runner and execute a set of tests (from the Nancy project - http://nancyfx.org) - it doesn't always crash, but seems to do so probably 4 out of 5 times. The crash is after running a random test, but the output is always:

* Assertion at mini-generic-sharing.c:285, condition `subclass->image == image' not met


Native stacktrace:

        mono() [0x80f71d9]
        /lib/i386-linux-gnu/libc.so.6(gsignal+0x4f) [0x1fd1ef]
        /lib/i386-linux-gnu/libc.so.6(abort+0x175) [0x200835]
        mono() [0x825f730]
        mono() [0x825f7b3]
        mono() [0x8100274]
        mono() [0x825c3ea]
        mono() [0x8100041]
        mono() [0x81798a6]
        mono() [0x814bc90]
        mono() [0x817990b]
        mono() [0x814bc90]
        mono(mono_domain_free+0x1e2) [0x81e6e62]
        mono() [0x81df8b9]
        mono() [0x82397d2]
        mono() [0x824912e]
        mono() [0x8257d08]
        /lib/i386-linux-gnu/libpthread.so.0(+0x6d4c) [0x8a9d4c]
        /lib/i386-linux-gnu/libc.so.6(clone+0x5e) [0x2b9ace]

Debug info from gdb:

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 source for these tests is pretty innocuous, but it can be found here: 


There are other assemblies which also crash it, and some that always seem to work, but the forms test one seems to reproduce the bug most reliably. This is currently breaking our CI builds on Mono 3.x, but it works fine on Mono 2.x (we CI build on .net, mono 2.x and mono 3.x for completeness)
Comment 1 Steven Robbins 2013-06-20 07:48:08 UTC
Created attachment 4167 [details]
Simple repro case
Comment 2 Steven Robbins 2013-06-20 10:15:58 UTC
If I add "-O=-gshared" to the mono command line it *seems* to make the problem go away, but the fact it crashes inside mono, and relatively randomly, still suggests to me this is a bug.
Comment 3 Zoltan Varga 2013-06-22 08:49:59 UTC
Fixed in ac8695db9fe1eeccf579964af5a4b8acd7deeceb. Thanks for the testcase.
Comment 4 Zoltan Varga 2013-06-22 22:19:13 UTC
-> fixed.
Comment 5 Ian Battersby 2013-08-23 15:40:22 UTC
*** Bug 11216 has been marked as a duplicate of this bug. ***