Bug 3666 - Intermittent crash on new UIView()
Summary: Intermittent crash on new UIView()
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.2
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-02-28 08:39 UTC by Damir Davletov
Modified: 2012-03-01 06:30 UTC (History)
3 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 Developer Community or GitHub 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 Damir Davletov 2012-02-28 08:39:46 UTC
There's a crash which happened only once so far with no obvious reasons. We are planning to upgrade to 5.2 but we'd like to make sure it'll fix the crash.

the codeline where it happens is:

	    UIView containerView = new UIView ();

MonoTouch is 5.1.1

The crash dump is below (sensitive info is removed).

Incident Identifier: 9920E0D6-7D2E-455E-A4C3-8F4A313D98AA
CrashReporter Key:   b352a20df7ca6ca0c0cd56d04b0c66116d598428
Hardware Model:      iPhone3,1
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2012-02-23 11:31:04.301 +0000
OS Version:      iPhone OS 5.0 (9A334)
Report Version:  104

Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x31fa432c __pthread_kill + 8
1   libsystem_c.dylib             	0x3649af54 pthread_kill + 48
2   libsystem_c.dylib             	0x36493fe4 abort + 88
3   App                    	0x007e63de mono_handle_native_sigsegv (mini-exceptions.c:2250)
4   App                    	0x007d2a7a mono_sigsegv_signal_handler (mini.c:5921)
5   libsystem_c.dylib             	0x364a5532 _sigtramp + 42
6   libsystem_c.dylib             	0x36458dbe pthread_mutex_trylock + 262
7   App                    	0x0088f694 GC_register_finalizer_no_order (finalize.c:498)
8   App                    	0x0081d69a object_register_finalizer (gc.c:303)
9   App                    	0x0081d7b0 mono_object_register_finalizer (gc.c:324)
10  App                    	0x0084e238 mono_object_new_alloc_specific (object.c:4336)
11  App                    	0x0084e388 mono_object_new_specific (object.c:4319)
12  App                    	0x00447a4c wrapper_managed_to_native_object___icall_wrapper_mono_object_new_specific_intptr (mscorlib.dll.7.s:541187)
13  App                    	0x006eefa4 monotouch_MonoTouch_Foundation_NSObject_InitializeObject_bool (monotouch.dll.7.s:24520)
14  App                    	0x006eed44 monotouch_MonoTouch_Foundation_NSObject__ctor_MonoTouch_Foundation_NSObjectFlag (monotouch.dll.7.s:24274)
15  App                    	0x006ff3f4 monotouch_MonoTouch_UIKit_UIResponder__ctor_MonoTouch_Foundation_NSObjectFlag (monotouch.dll.7.s:48743)
16  App                    	0x00705f0c monotouch_MonoTouch_UIKit_UIView__ctor (monotouch.dll.7.s:59386)

Comment 1 Sebastien Pouliot 2012-02-28 13:54:35 UTC
I've been running a memory torture test lately (creating tons of NSObject derived objects) and I have not seen a similar crashes. Of course if this occurs when running out of memory it might be hard (or even impossible) to duplicate the exact same crash.

If you can share (mark it private) the full stack trace, crash dump and your build options we can try to duplicate it with the latest code (i.e. what's being QA'ed right now).

Also there were a lot of (other) fixes done between the early 5.1 (beta) days and the latest 5.2.5 (stable) release that would make your upgrade worthwhile.
Comment 4 Damir Davletov 2012-02-29 10:17:59 UTC
It doesn't seem to be a memory issue there is no memory warnings and other processes aren't being killed.

the build settings we use are the following (only trimmed 3rd party libs):

"MtouchExtraArgs" = "-aot \"nimt-trampolines=2048\" -gcc_flags '-lgcc_eh"

"DefineConstants" = "MONOTOUCH;PRODUCTION;"
"Optimize" = "true"
"MtouchUseLlvm" = "true"
"MtouchArch" = "ARMv6_ARMv7"
"MtouchUseThumb" = "false"
Comment 5 Rolf Bjarne Kvinge [MSFT] 2012-02-29 18:22:57 UTC
Does it still happen if you create a new project from a template and do "UIView containerView = new UIView ();" there? If not, it's likely an issue with your project, and we'd probably need to access it to find out what's going on.
Comment 6 Damir Davletov 2012-03-01 05:09:08 UTC
This crash happened only once in testing and is not reproducible. Creating new project will not give us a definitive result since it may not crash until went into production. We are going to upgrade to 5.2 and hopefully GC fixes if there are any will fix this issue.
I'll also let you know if something like this happens again.
Thanks for looking into it. It definitely helps that you don't see issues like this often.
Comment 7 Rolf Bjarne Kvinge [MSFT] 2012-03-01 06:30:32 UTC
I will close this since it's not reproducible: if you find a way to reproduce it, please reopen the bug report and we'll have another look at it.