Bug 44922 - Assertion at lock-free-alloc.c:457, condition `block_size == desc->block_size' not met
Summary: Assertion at lock-free-alloc.c:457, condition `block_size == desc->block_size...
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: PC Mac OS
: --- major
Target Milestone: ---
Assignee: Vlad Brezae
Depends on:
Reported: 2016-09-30 11:05 UTC by Marek Safar
Modified: 2016-10-05 11:15 UTC (History)
4 users (show)

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:

Description Marek Safar 2016-09-30 11:05:55 UTC
Happens when using roslyn compiler.

One example


* Assertion at lock-free-alloc.c:457, condition `block_size == desc->block_size' not met

Native stacktrace:

	0   mono                                0x001493a1 mono_handle_native_sigsegv + 353
	1   mono                                0x001a3541 sigabrt_signal_handler + 161
	2   libsystem_platform.dylib            0x9d46179b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   libsystem_c.dylib                   0x92851c38 abort + 156
	5   mono                                0x00304478 mono_log_write_logfile + 376
	6   mono                                0x002ff052 structured_log_adapter + 50
	7   mono                                0x003203a4 monoeg_g_logv + 100
	8   mono                                0x003204fb monoeg_assertion_message + 43
	9   mono                                0x0030dde9 mono_lock_free_free + 745
	10  mono                                0x002cd280 sgen_free_internal_dynamic + 144
	11  mono                                0x002ce3ab sgen_los_scan_card_table + 411
	12  mono                                0x002cb117 job_mod_union_preclean + 87
	13  mono                                0x002ebd60 thread_func + 240
	14  libsystem_pthread.dylib             0x9e2b6780 _pthread_body + 138
	15  libsystem_pthread.dylib             0x9e2b66f6 _pthread_body + 0
	16  libsystem_pthread.dylib             0x9e2b3f7a thread_start + 34

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.YuODYi'
Executing commands in '/tmp/mono-gdb-commands.YuODYi'.
(lldb) process attach --pid 94341
error: attach failed: unable to attach

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.
Comment 1 Marek Safar 2016-10-04 09:22:01 UTC
This is quite reliable when compiling mscorlib on linux

Trace from the assert

(gdb) bt
#0  mono_lock_free_free (ptr=0xf533f554, block_size=4096) at lock-free-alloc.c:457
#1  0x08342e1d in sgen_free_internal_dynamic (addr=0xf533f554, size=4096, type=32) at sgen-internal.c:206
#2  0x08343ec3 in sgen_los_scan_card_table (scan_type=scan_type@entry=CARDTABLE_SCAN_MOD_UNION_PRECLEAN, ctx=...) at sgen-los.c:662
#3  0x0833b7eb in job_mod_union_preclean (worker_data_untyped=0xf7d6e004, job=0xf3f02cc4) at sgen-gc.c:1395
#4  0x0835b4d5 in thread_func (thread_data=0xf7d6e004) at sgen-thread-pool.c:117
#5  0xf7f67f70 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0xf7e9e70e in clone () from /lib/i386-linux-gnu/libc.so.6
(gdb) p *desc
Cannot access memory at address 0x0
(gdb) p *ptr
Attempt to dereference a generic pointer.
(gdb) p ptr
$2 = (gpointer) 0xf533f554
Comment 2 Bernhard Urban 2016-10-05 11:15:17 UTC