Bug 39442 - Crash due to JNI reference
Summary: Crash due to JNI reference
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 6.0.1 (C6SR1)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2016-03-08 11:12 UTC by Fabien Molinet
Modified: 2017-08-23 20:53 UTC (History)
5 users (show)

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

Mono and Xamarin Android version (1.68 KB, text/plain)
2016-03-08 11:12 UTC, Fabien Molinet
Application output with all logs (3.91 MB, text/plain)
2016-03-08 11:14 UTC, Fabien Molinet

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 Fabien Molinet 2016-03-08 11:12:40 UTC
Created attachment 15303 [details]
Mono and Xamarin Android version

We get JNI crashes on an Asus ZenPad S 8.0 tablet with Android 5.0:
   [art] JNI ERROR (app bug): attempt to use stale global reference 0x60067e (should be 0x70067e)

We get them when scrolling extremely fast in a RecyclerView where images are being displayed, bitmaps are reused and only disposed when necessary. We rely on FFImageLoading for that last part.

We also get the issue with a simple sample, available here:
If you open the solution and set "Samples/Simple.Android.Sample" as the start project, then you will be able to see the app.

This sample app has a "Swipe gallery" and a "Recycler view". If you go in Recycler view and scroll it extremely fast then at some point you will face the JNI issue.

I attached a full application output with all logs (adb shell setprop debug.mono.log all).
Comment 1 Fabien Molinet 2016-03-08 11:14:20 UTC
Created attachment 15304 [details]
Application output with all logs
Comment 2 Boris Spinner 2016-06-03 07:53:13 UTC
We're also getting this crashes.
Comment 3 Prashant [MSFT] 2017-06-29 06:33:16 UTC
Thank you for taking the time to submit the bug. We are unable to reproduce this issue on bunch of Test devices. Please attach a reproduction to the bug by starting with a clean Xamarin.Android project and adding just the code necessary to demonstrate the issue. 

FFIImageLoading sample works without any crashes!
Comment 4 Cody Beyer (MSFT) 2017-08-23 20:53:03 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!