Bug 7167 - General instability running on Samsung Galaxy S3
Summary: General instability running on Samsung Galaxy S3
Status: RESOLVED DUPLICATE of bug 7013
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-09-13 21:44 UTC by Jared Kells
Modified: 2012-09-14 10:53 UTC (History)
2 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 Jared Kells 2012-09-13 21:44:44 UTC
We are experiencing general instability on the Galaxy S3.
Monodroid Version: 4.2.5
Android Version: 4.0.4

The crashes only occur in a release build or a debug build using the release linking options.
A workaround seems to be enabling armeabi-v7a under supported architectures.

The most reliable consistent way to crash the application seems to be using LINQ on XElements. The following code will crash on the S3 roughly 50% of the time.

        private static void StressTest()
            for (int i = 0; i < 5000; i++)
                Log.Debug("S3Crash", "Starting iteration {0}", i);
                IEnumerable<XElement> elements = new[] { new XElement(DataNamespace.GetName("field"), new XAttribute(XNamespace.None.GetName("var"), "software_version")) };
                Log.Debug("S3Crash", "softwareInfo allocated");
                for (int j = 0; j < 20; ++j)
                    XElement software_version = elements.First(item => item.Attribute(XNamespace.None.GetName("var")).Value == "software_version");
                Log.Debug("S3Crash", "software_version found");

This will cause the following exception:
09-14 11:25:36.975: I/MonoDroid(29246): UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
09-14 11:25:36.975: I/MonoDroid(29246): at S3Crash.Activity1.<StressTest>b__0 (System.Xml.Linq.XElement) [0x00000] in c:\projects\S3Crash\S3Crash\Activity1.cs:36
09-14 11:25:36.975: I/MonoDroid(29246): at System.Linq.Enumerable.First<System.Xml.Linq.XElement> (System.Collections.Generic.IEnumerable`1<System.Xml.Linq.XElement>,System.Func`2<System.Xml.Linq.XElement, bool>,System.Linq.Enumerable/Fallback) <0x00157>
09-14 11:25:36.975: I/MonoDroid(29246): at System.Linq.Enumerable.First<System.Xml.Linq.XElement> (System.Collections.Generic.IEnumerable`1<System.Xml.Linq.XElement>,System.Func`2<System.Xml.Linq.XElement, bool>) <0x000ab>
09-14 11:25:36.975: I/MonoDroid(29246): at S3Crash.Activity1.StressTest () [0x0007e] in c:\projects\S3Crash\S3Crash\Activity1.cs:36
09-14 11:25:36.975: I/MonoDroid(29246): at S3Crash.Activity1.OnCreate (Android.OS.Bundle) [0x00009] in c:\projects\S3Crash\S3Crash\Activity1.cs:23
09-14 11:25:36.975: I/MonoDroid(29246): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <IL 0x00012, 0x000e7>
09-14 11:25:36.975: I/MonoDroid(29246): at (wrapper dynamic-method) object.660b4ff4-d03e-4212-9720-cb7074b04154 (intptr,intptr,intptr) <IL 0x00012, 0x00033>


We have also seen other random crashes, some in the GC such as this:

09-14 11:32:55.470 F/        (30125): * Assertion: should not be reached at /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.5-branch/fbf243f0/source/mono/mono/metadata/sgen-scan-object.h:109
09-14 11:32:55.470 I/mono    (30125): Stacktrace:
09-14 11:32:55.470 I/mono    (30125): 
09-14 11:32:55.470 I/mono    (30125):   at S3Crash.Activity1.StressTest22 () [0x00001] in c:\projects\S3Crash\S3Crash\Activity1.cs:32
09-14 11:32:55.470 I/mono    (30125):   at System.Threading.Tasks.TaskActionInvoker/ActionInvoke.Invoke (System.Threading.Tasks.Task,object,System.Threading.Tasks.Task) <IL 0x00006, 0x00063>
09-14 11:32:55.470 I/mono    (30125):   at System.Threading.Tasks.Task.InnerInvoke () <IL 0x00036, 0x00107>
09-14 11:32:55.470 I/mono    (30125):   at System.Threading.Tasks.Task.ThreadStart () <IL 0x0007c, 0x0041f>
09-14 11:32:55.470 I/mono    (30125):   at System.Threading.Tasks.Task.Execute () <IL 0x00001, 0x00047>
09-14 11:32:55.470 I/mono    (30125):   at System.Threading.Tasks.TpScheduler.TaskExecuterCallback (object) <IL 0x00008, 0x000b3>
09-14 11:32:55.470 I/mono    (30125):   at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00052, 0xffffffff>


This issue could be related to: 
Comment 1 Jonathan Pryor 2012-09-14 10:53:39 UTC

*** This bug has been marked as a duplicate of bug 7013 ***