Bug 15599 - Crash on Kindle Fire HD running Wordament app
Summary: Crash on Kindle Fire HD running Wordament app
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.8.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2013-10-22 17:31 UTC by Jon Goldberger [MSFT]
Modified: 2017-06-29 01:06 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
kindle crash logcat output (36.73 KB, text/plain)
2013-10-28 13:16 UTC, cheyne
Details
kindle OpenGLOutOfMemory error (21.89 KB, text/plain)
2013-10-28 13:17 UTC, cheyne
Details


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:
Status:
RESOLVED ANSWERED

Comment 1 Jon Goldberger [MSFT] 2013-10-22 17:34:01 UTC
We are having problems with our app, Wordament, that appear to be specific to Kindle Fire devices (in particular we know it repros on Kindle Fire HD 7"). The app crashes during a specific phase of our game, but the debugger doesn't trigger and I don't seem to be getting useful information from the ADB log. I see it repro indeterministically, but I have repro steps that usually (~90%) work.

I've attached the ADB log to the crash as KindleCrash.txt. The crash has no stacktrace:
mono-rt Stacktrace:
mono-rt
mono-rt
mono-rt =================================================================
mono-rt Got a SIGSEGV while executing native code. This usually indicates
mono-rt used by your application.
mono-rt =================================================================
mono-rt

In trying to figure out a culprit, I've been disabling anything interesting - sound, ad controls, etc., and what I find is that the more I disable, the crash happens less and less often, but often with an "OpenGLRenderer out of memory" error taking its place. After this happens, our text renders as jibberish (not surprisingly), but there is no crash. This log is contained in KindleOpenGLOutOfMemory.txt, and here is the OpenGLRenderer error:
OpenGLRenderer GL error from OpenGLRenderer: 0x505
OpenGLRenderer OpenGLRenderer is out of memory!

The issues both always seem to happen at a specific point in our game loop - as we transition from our game view to our results view. The results view is interesting because it is the most layout and view-intense point in our app. We create ~1000 views and most of them are custom Views that render text in OnDraw. I've verified that we make it through our layout /create view code before we crash, but I have also verified that if I stub the view and stop creating our long word lists we no longer run into any issues.

So, as far as I can tell, this issue has something to do with the memory pressure being applied during this phase of our game. I will note that we run without these issues on much less powerful devices (I've been developing / testing using a Prism II , which has 1 GHz single core processor, 512 MB RAM), and I haven't seen any interesting memory spikes in the Android Monitor - we seem to peak just under 20 MB.

At this point I'm looking for pointers on how to narrow this issue down, and if there are any known issues with Kindle Fire devices?
=========================================================

Kindle Fire HD 7” is running Kindle 7.4.6, which is apparently built on Ice Cream Sandwich, and our app is targeting API Level 15 (Android 4.0.3). It’s not clear to me if the Kindle system software is diverged from 4.0.0 or 4.0.3.

Here the interesting VS/Xamarin.Android version info:

Microsoft Visual Studio Ultimate 2012
Version 11.0.60610.01 Update 3
Microsoft .NET Framework
Version 4.5.51641

Visual C# 2012 04940-004-0039002-02301
Microsoft Visual C# 2012

Visual C++ 2012 04940-004-0039002-02301
Microsoft Visual C++ 2012

Xamarin.Android 4.8.03015 (a25a31d0)
Visual Studio plugin to enable development for Xamarin.Android.
=========================================================
App can be downloaded from: https://play.google.com/store/apps/details?id=com.microsoft.wordament
Comment 2 cheyne 2013-10-28 13:16:49 UTC
Created attachment 5254 [details]
kindle crash logcat output
Comment 3 cheyne 2013-10-28 13:17:17 UTC
Created attachment 5255 [details]
kindle OpenGLOutOfMemory error
Comment 4 Radek Doulik 2013-10-29 12:48:41 UTC
This looks like a problem of how the android renders big fonts. There might be few ways how to overcome it for you.

You can disable hardware acceleration on the text views with big font sizes like

yourTextView.SetLayerType (LayerType.Software, null);

Another (more complicated) way would be to render the text yourself as a path by using http://androidapi.xamarin.com/?link=M%3aAndroid.Graphics.Paint.GetTextPath(string%2cint%2cint%2cfloat%2cfloat%2cAndroid.Graphics.Path) and rendeing the path yourself.

Or you can try to reduce the font size if possible.
Comment 5 Chris Hardy [MSFT] 2017-06-29 01:06:08 UTC
Answered