App containing webview w CSS animations crashes spawning threads, w Debugger attached on Xiomi Mi3

Hi,
While debugging a more complex app, I found out an odd behavior on a Xiomi Mi3 device (it ships with the MIUI-5 "unoffical" android rom, reproduced on both Jelly bean 4.2 and 4.3)
The problem does not happen on my Galaxy Nexus (both stock and cyanogenmod 4.4).
Haven't tried it on other devices yet.

Attached a small project for reproducing the problem: just launch it from the debugger and press fast enough the "click me" button.
If you want to accelerate it crashing, uncomment the instruction "//wv.LoadUrl("javascript:AnimationOn('')"

The debugger registers a NullPointer exception usually on the "Thread.Start" method; I also see this in the "Application Output" the following lines:

[crash_handler] Caught a crash, signum=11
Thread finished: #3
[webcore] Report WebCore crash to the ErrorReportUtils at:Tue Apr 29 10:48:18 CEST 2014

If you run the app without the debugger, you will see no problem/crash.

My understanding is that there is some kind of thread initialization code that happens in the webview on that device (that doesn't happen on other devices) that causes memory corruption in the MonoVM when the debugger is attached.

My main concern is that, even if I was not able to reproduce it on more devices and without the Debugger attached, I can not exclude that the problem could happen in the wild often enough. This is not an uncommon scenario since basically all the ad networks SDK leverage on the webview for displaying rich advertising.

Any other people in the forum can test the app and let me know if they see the same crash?

Posts

  • PlatformTeamPlatformTeam USMember
    edited March 2015

    Seems similar to my bug reported here : https://bugzilla.xamarin.com/show_bug.cgi?id=27455
    As you can see, neither me nor Jonathan from Xamarin was able to identify the problem.
    But today I discovered something that seems to resolve the issue - clear and disable cache (dont ask me why clear is needed even if cache use is disabled, but for me, it works only then) :

    public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
            {            
                webView = new WebView(this.Activity);
                webView.ClearCache(true);
                webView.Settings.CacheMode = CacheModes.NoCache; 
                webView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
    
                return webView;
            }
    
Sign In or Register to comment.