Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 18909 [details]
Simple test project for reproducing the issue
We have an app that is using ModernHttpClient to make HTTP requests. We've noticed that if ModernHttpClient throws an exception (that we catch) the app will crash the next time that a garbage collect is performed. When the app crashes it logs a "JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0x7f58cec5e0" error and a huge stack trace.
This only seems to happen on Cycle 8 releases (not on Cycle 7 or the most recent Cycle 9 release, Xamarin.Android 22.214.171.124). Also, it only happens when ModernHttpClient is used. If I switch to HttpClientHandler or AndroidClientHandler the app doesn't crash.
I've broken out the code from our project to a simple test project.
Steps to reproduce:
1. Put the device in airplane mode
2. Launch the app
3. Press the "Send get request" button
a. An exception will be thrown since the device doesn't have a connection.
4. Press the "Send get request" button a second time
5. Press the "Manual GC call" button
In the test project that I've attached I need to send two requests for the issue to occur, in our real project the issue occurs after one request.
I don't know if this is a bug in Xamarin or in ModernHttpClient, but even if it is a bug in ModernHttpClient I would like to know why it only occurs in Cycle 8 releases. If I try the same thing in Cycle 7 (Xamarin.Android 126.96.36.199) or Cycle 9 (Xamarin.Android 188.8.131.52) releases the app doesn't crash.
Just noticed that this may be a duplicate of: https://bugzilla.xamarin.com/show_bug.cgi?id=45003
Any news in regards to this issue?
The bug is caused by ModernHttp setting a Java exception into a Task.
See this comment in in ModernHttp repo:
It can be easily fixed in ModernHttp code.
This has been fixed in a fork of ModernHTTPClient, however that fork has not turned into a PR as far as I can tell.
Please see https://github.com/Youscribe/ModernHttpClient/tree/hotfix/cycle8-issue