Bug 4060 - GC.Collect() crashes when running a serializer test suite
Summary: GC.Collect() crashes when running a serializer test suite
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-03-23 05:15 UTC by Tomi Valkeinen
Modified: 2012-06-19 12:15 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 FIXED

Description Tomi Valkeinen 2012-03-23 05:15:11 UTC
Description of Problem:

When running the test suite for NetSerializer, a serializer library, mono crashes in a GC.Collect() call.

NetSerializer can be found from git://github.com/tomba/netserializer.git and the HEAD I was using for tests is ffbf94fcc15686f8eadec3f2c5b10a8a92127057

I'm running Ubuntu 11.04, kernel is:

Linux deskari 2.6.38-13-generic #57-Ubuntu SMP Mon Mar 5 18:29:54 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Mono I'm using is:

Mono JIT compiler version 2.11 (tarball Fri Mar 23 09:52:17 EET 2012)
Copyright (C) 2002-2011 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:            Included Boehm (with typed GC and Parallel Mark)



Steps to reproduce the problem:
1. Compile NetSerializer: xbuild /p:Configuration=Release
2. Run: mono ./Test/bin/Release/Test.exe
3. Repeat a few times, until crashes


Actual Results:

== 5000 ByteArrayMessage ==
NetSerializer | MemStream Serialize   |        380 |   0   0   0 |  251267200 |
NetSerializer | MemStream Deserialize |         83 |   0   0   0 |            |
mmap(...PROT_NONE...) failed
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.GC.InternalCollect (int) <0xffffffff>
  at System.GC.Collect () <0x00010>
  at Test.Program.Test (Test.IMemStreamTest,Test.MessageBase[]) <0x00044>
  at Test.Program.RunTests (System.Type,int) <0x000e7>
  at Test.Program.Main (string[]) <0x0020f>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	mono() [0x498377]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0xfc60) [0x7f861cedcc60]
	/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35) [0x7f861cb6bd05]
	/lib/x86_64-linux-gnu/libc.so.6(abort+0x186) [0x7f861cb6fab6]
	mono() [0x5d89bc]
	mono() [0x5dfaee]
	mono() [0x5e97a3]
	mono() [0x5e8312]
	mono() [0x5e79a9]
	mono() [0x5e83bb]
	mono() [0x5e8403]
	[0x40e6d2da]

Debug info from gdb:

Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.

=================================================================
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.
=================================================================

Aborted


Expected Results:

No crash.

How often does this happen? 

Sometimes. Perhaps 1/10 of the test runs. It seems to always happen at the same spot, in ByteArrayMessage test.

Additional Information:
Comment 1 Rodrigo Kumpera 2012-04-22 22:56:26 UTC
I can't reproduce this with trunk.

Can you repro with 2.12.1.
Comment 2 Tomi Valkeinen 2012-04-23 03:18:39 UTC
Where can I find 2.12.1? Latest I can find is 2.11.2.
Comment 3 Rodrigo Kumpera 2012-04-23 11:22:50 UTC
Sorry, I mean 2.11.2.
Comment 4 Tomi Valkeinen 2012-04-25 09:47:43 UTC
I can reproduce this with 2.11.2 (HEAD today, 8960ec52a54a884c9bc00c181984e1cc0c925777). I needed perhaps 5 runs of the test suite to get the crash.
Comment 5 Rodrigo Kumpera 2012-06-19 12:15:52 UTC
Fixed.