Bug 2810 - GC Crash: condition `mono_sgen_need_bridge_processing ()' not met
Summary: GC Crash: condition `mono_sgen_need_bridge_processing ()' not met
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: PC Mac OS
: Normal major
Target Milestone: ---
Assignee: Rodrigo Kumpera
Depends on:
Reported: 2012-01-09 15:22 UTC by Miguel de Icaza [MSFT]
Modified: 2012-01-25 12:32 UTC (History)
7 users (show)

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

Sample test case that produces the crash. (2.78 KB, application/octet-stream)
2012-01-09 15:22 UTC, Miguel de Icaza [MSFT]

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 Miguel de Icaza [MSFT] 2012-01-09 15:22:14 UTC
Created attachment 1142 [details]
Sample test case that produces the crash.

This bug was reported by PJ in an existing bug that was fixed (#228), using the attached sample, he gets this crash report, using:

Mono 2.10.8
MacOS 10.7.2

I myself, can not reproduce this.

$ dmcs t.cs && mono-sgen t.exe
t.cs(71,15): warning CS0660: `MyId' defines operator == or operator != but does not override Object.Equals(object o)
t.cs(71,15): warning CS0661: `MyId' defines operator == or operator != but does not override Object.GetHashCode()
t.cs(72,10): warning CS0169: The private field `MyId.a' is never used
t.cs(73,10): warning CS0169: The private field `MyId.b' is never used
t.cs(74,10): warning CS0169: The private field `MyId.c' is never used
t.cs(75,9): warning CS0169: The private field `MyId.d' is never used
t.cs(76,12): warning CS0169: The private field `MyId.e' is never used
t.cs(77,10): warning CS0169: The private field `MyId.f' is never used
t.cs(78,10): warning CS0169: The private field `MyId.g' is never used
Compilation succeeded - 9 warning(s)
* Assertion at sgen-gc.c:2506, condition `mono_sgen_need_bridge_processing ()' not met


  at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_obj (intptr,intptr) <0xffffffff>
  at (wrapper alloc) object.AllocSmall (intptr) <0xffffffff>
  at Fox.GetHashCode () <0x0019f>
  at Bear.GetHashCode () <0x00063>
  at System.Collections.Generic.EqualityComparer`1/DefaultComparer<Bear>.GetHashCode (Bear) <0x00017>
  at System.Collections.Generic.Dictionary`2<Bear, string>.set_Item (Bear,string) <0x0006c>
  at Test.Main (string[]) <0x00193>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	0   mono-sgen                           0x00092c6c mono_handle_native_sigsegv + 284
	1   mono-sgen                           0x000dcebd sigabrt_signal_handler + 109
	2   libsystem_c.dylib                   0x913ef59b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   libsystem_c.dylib                   0x9138abdd abort + 167
	5   mono-sgen                           0x00281ed3 monoeg_g_logv + 243
	6   mono-sgen                           0x00281f86 monoeg_assertion_message + 54
	7   mono-sgen                           0x001e6ab4 stw_bridge_process + 68
	8   mono-sgen                           0x001ee228 restart_world + 216
	9   mono-sgen                           0x001ea140 minor_collect_or_expand_inner + 288
	10  mono-sgen                           0x001eab32 mono_gc_alloc_obj_nolock + 1138
	11  mono-sgen                           0x001eaf24 mono_gc_alloc_obj + 164
	12  ???                                 0x0048a230 0x0 + 4760112
	13  ???                                 0x004855d8 0x0 + 4740568
	14  ???                                 0x00489c58 0x0 + 4758616
	15  ???                                 0x00489a4c 0x0 + 4758092
	16  ???                                 0x004899d0 0x0 + 4757968
	17  ???                                 0x0048963d 0x0 + 4757053
	18  ???                                 0x00484f64 0x0 + 4738916
	19  ???                                 0x004850d3 0x0 + 4739283
	20  mono-sgen                           0x0000cff2 mono_jit_runtime_invoke + 722
	21  mono-sgen                           0x001a4c8a mono_runtime_invoke + 170
	22  mono-sgen                           0x001a7821 mono_runtime_exec_main + 705
	23  mono-sgen                           0x001a6a31 mono_runtime_run_main + 929
	24  mono-sgen                           0x00067ee5 mono_jit_exec + 149
	25  mono-sgen                           0x0006a473 mono_main + 9603
	26  mono-sgen                           0x00002009 main + 441
	27  mono-sgen                           0x00001e16 start + 54

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.

Abort trap: 6
Comment 1 PJ 2012-01-09 16:09:34 UTC
I just reproduced this crash.

Mono 2.10.8 ( .1  but it's not showing up in version info)
MonoDevelop 2.8.6

Here's what I did to reproduce:

Comment 2 Zoltan Varga 2012-01-24 00:42:28 UTC
Please make sure you are really using, it identifies itself as such in mono-sgen --version.
Comment 3 Zoltan Varga 2012-01-24 00:54:55 UTC
miguel: it might be useful to promote to stable, since sgen is basically broken in 2.10.8, and we get a lot of duplicate bug reports about it.
Comment 4 Miguel de Icaza [MSFT] 2012-01-24 08:28:05 UTC

Packaging-wise the only difference between 2.10.8 and was the Gtk+ stack that we shipped with it.

We did not do a different release of Mono for it.

We can certainly do a new pair of Mono releases, one with the current Gtk and one with the new one (2.10.9 and respectively)

Comment 5 Zoltan Varga 2012-01-24 09:50:29 UTC
There is a tag in git, which includes this commit:

commit 53d8062782d2019ff8bee4a6dff3ed316ce38a54
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date:   Fri Dec 16 12:02:35 2011 -0200

    Fix sgen

which seems to fix this problem for me.
Comment 6 Miguel de Icaza [MSFT] 2012-01-24 22:12:31 UTC
Thanks for the information.

Ok, tomorrow we will discuss whether publishing a with the fix in stable, or whether we just upgrade the entire stack with the new Gtk for users
Comment 7 Duncan Mak 2012-01-25 01:15:57 UTC
Let's make sure that does not have this problem.

Zoltan is correct that Kumpera's sgen fix commit (53d80627) is part of the release. 

That commit is not part of 2.10.8.
Comment 8 PJ 2012-01-25 11:07:55 UTC
After upgrading to, I was able to run the test case with no crash.

The issue with mono version was sorted out with help from Duncan (bug 2649). Thanks all!
Comment 9 Zoltan Varga 2012-01-25 11:52:09 UTC
-> fixed.