Bug 28785 - AppDomain: Instability when creating in Parallel - Parallel.For - few
Summary: AppDomain: Instability when creating in Parallel - Parallel.For - few
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Alexander Kyte
URL:
Depends on:
Blocks:
 
Reported: 2015-04-05 09:29 UTC by Alexandre Faria
Modified: 2017-09-06 15:26 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 Alexandre Faria 2015-04-05 09:29:07 UTC
Description of Problem:
Mono crashes very fast when trying to create AppDomains in parallel using Parallel.For

It may have the same underlying cause as 13813. 

Steps to reproduce the problem:

Parallel.For(0, 10000, i =>
{
  System.Console.WriteLine("\n\nIteration " + i);
  AppDomain ad = AppDomain.CreateDomain("ChildDomain");
  AppDomain.Unload(ad);
});


Actual Results:
It crashes quite fast:

Stacktrace:


Native stacktrace:

	mono(mono_handle_native_sigsegv+0xc8) [0x4d0798]
	mono(mono_arch_handle_altstack_exception+0xbe) [0x526c4e]
	mono(mono_sigsegv_signal_handler+0xf8) [0x44fb78]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7f9b079d7340]
	mono() [0x60df2d]
	mono() [0x5b435d]
	mono() [0x600c75]
	mono() [0x6037f6]
	mono() [0x6040dd]
	mono() [0x6041fa]
	mono(sgen_perform_collection+0x4c8) [0x6074d8]
	mono(mono_gc_collect+0x28) [0x607de8]
	mono() [0x5d2cda]
	mono() [0x65a75e]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x8182) [0x7f9b079cf182]
	/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f9b076fc47d]

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: Operação não permitida.
No threads.

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================


Expected Results:
It should terminate properly...

How often does this happen? 
Always


Additional Information:
Mono JIT compiler version 4.1.0 (master/199cc80 Dom Abr  5 11:19:29 WEST 2015)
Copyright (C) 2002-2014 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:            sgen
Comment 1 Alexander Kyte 2015-04-20 14:14:29 UTC
The fix to this is part of this PR: https://github.com/mono/mono/pull/1654