Bug 45003 - SIGABRT after Exceptions in OkHttp
Summary: SIGABRT after Exceptions in OkHttp
Status: ASSIGNED
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 7.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2016-10-04 10:09 UTC by Louis Haußknecht
Modified: 2017-02-15 10:23 UTC (History)
11 users (show)

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


Attachments
Sample app (45.38 KB, application/x-zip-compressed)
2016-10-04 10:09 UTC, Louis Haußknecht
Details

Description Louis Haußknecht 2016-10-04 10:09:19 UTC
Created attachment 17859 [details]
Sample app

We are using the modernhttpclient in our xamarin forms app and discovered fatal app crashes after we installed Xamarin 4.2 (Mono 7.0). (Modernhttpclient wraps okHttp)

Steps to reproduce: Open the attached sample app. Turn off network. Issue many calls (and resulting Exceptions) by clicking on the button repeatedly.

Going back to Cycle 7 resolves this bug.


09-29 16:53:42.741: W/dalvikvm(14941): Invalid indirect reference 0xa2590e20 in decodeIndirectRef 09-29 16:53:42.741: I/dalvikvm(14941): "OkHttp https://*****/token" prio=5 tid=14 RUNNABLE 09-29 16:53:42.741: I/dalvikvm(14941): | group="main" sCount=0 dsCount=0 obj=0xb30f97f8 self=0xb8ff6130 09-29 16:53:42.741: I/dalvikvm(14941): | sysTid=15173 nice=0 sched=0/0 cgrp=apps handle=-1179120768 09-29 16:53:42.741: I/dalvikvm(14941): | state=R schedstat=( 49673122 22762814 2813 ) utm=4 stm=0 core=0 09-29 16:53:42.741: I/dalvikvm(14941): at md595f4b8ab717b9da13f11267a86077f20.AwaitableOkHttp_OkTaskCallback.monodroidAddReference(AwaitableOkHttp_OkTaskCallback.java:-1) 09-29 16:53:42.741: I/dalvikvm(14941): at md595f4b8ab717b9da13f11267a86077f20.AwaitableOkHttp_OkTaskCallback.n_onResponse(Native Method) 09-29 16:53:42.741: I/dalvikvm(14941): at md595f4b8ab717b9da13f11267a86077f20.AwaitableOkHttp_OkTaskCallback.onResponse(AwaitableOkHttp_OkTaskCallback.java:39) 09-29 16:53:42.741: I/dalvikvm(14941): at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:168) 09-29 16:53:42.741: I/dalvikvm(14941): at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) 09-29 16:53:42.741: I/dalvikvm(14941): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 09-29 16:53:42.741: I/dalvikvm(14941): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 09-29 16:53:42.741: I/dalvikvm(14941): at java.lang.Thread.run(Thread.java:841) 09-29 16:53:42.741: E/dalvikvm(14941): VM aborting 09-29 16:53:42.741: A/libc(14941): Fatal signal 6 (SIGABRT) at 0x00003a5d (code=-6), thread 15173 (OkHttp Dispatch)
Comment 1 Marek Habersack 2016-10-05 11:08:00 UTC
Posting the trace again to make it more readable:

09-29 16:53:42.741: W/dalvikvm(14941): Invalid indirect reference 0xa2590e20 in decodeIndirectRef 
09-29 16:53:42.741: I/dalvikvm(14941): "OkHttp https://*****/token" prio=5 tid=14 RUNNABLE 
09-29 16:53:42.741: I/dalvikvm(14941): | group="main" sCount=0 dsCount=0 obj=0xb30f97f8 self=0xb8ff6130 
09-29 16:53:42.741: I/dalvikvm(14941): | sysTid=15173 nice=0 sched=0/0 cgrp=apps handle=-1179120768 
09-29 16:53:42.741: I/dalvikvm(14941): | state=R schedstat=( 49673122 22762814 2813 ) utm=4 stm=0 core=0 
09-29 16:53:42.741: I/dalvikvm(14941): at md595f4b8ab717b9da13f11267a86077f20.AwaitableOkHttp_OkTaskCallback.monodroidAddReference(AwaitableOkHttp_OkTaskCallback.java:-1) 
09-29 16:53:42.741: I/dalvikvm(14941): at md595f4b8ab717b9da13f11267a86077f20.AwaitableOkHttp_OkTaskCallback.n_onResponse(Native Method) 
09-29 16:53:42.741: I/dalvikvm(14941): at md595f4b8ab717b9da13f11267a86077f20.AwaitableOkHttp_OkTaskCallback.onResponse(AwaitableOkHttp_OkTaskCallback.java:39) 
09-29 16:53:42.741: I/dalvikvm(14941): at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:168) 
09-29 16:53:42.741: I/dalvikvm(14941): at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) 
09-29 16:53:42.741: I/dalvikvm(14941): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
09-29 16:53:42.741: I/dalvikvm(14941): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
09-29 16:53:42.741: I/dalvikvm(14941): at java.lang.Thread.run(Thread.java:841) 09-29 16:53:42.741: E/dalvikvm(14941): VM aborting 
09-29 16:53:42.741: A/libc(14941): Fatal signal 6 (SIGABRT) at 0x00003a5d (code=-6), thread 15173 (OkHttp Dispatch)
Comment 2 Marek Habersack 2016-10-05 11:20:58 UTC
@Louis, could you please attach full version information from Visual Studio for the release that gives you problems?

I was unable to reproduce the issue (after issuing over a 1000 requests with network turned off) using XA from master. Furthermore, the stack trace you posted contains no code from Xamarin.Android, Xamarin.Frameworks or Mono - it is pure Java, and the crash occurs in libc. This suggests the issue might be somewhere else. But, perhaps there's more information in logcat which surrounds the above exception? Could you please check whether there are any managed stack traces before/after the code above? Any errors/warnings marked with [Mono] or [monodroid] or [mono-stdout]? Thanks!
Comment 3 Yann ROBIN 2016-10-12 15:17:54 UTC
Hi Marek,

I'm also affected by this issue. I've created a small project to reproduce the issue :
https://github.com/Youscribe/SigAbrtModernHttpClient

Launch the application, go airplane mode, click multiple time on the button labeled "modernhttpclient".

At some point you should see a crash.

I've found why it occurs, it's explained here :
https://github.com/paulcbetts/ModernHttpClient/issues/229?_pjax=%23js-repo-pjax-container#issuecomment-253214125


For the record, I'm sick of xamarin !
Comment 4 Jon Goldberger [MSFT] 2016-10-12 20:06:38 UTC
Setting back to confirmed in light of info in comment 3. 

Version info from customer in comment 3:

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Enterprise

Architecture and Modeling Tools 00322-80000-00000-AA896
Microsoft Architecture and Modeling Tools

UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015 00322-80000-00000-AA896
Microsoft Visual Basic 2015

Visual C# 2015 00322-80000-00000-AA896
Microsoft Visual C# 2015

Visual C++ 2015 00322-80000-00000-AA896
Microsoft Visual C++ 2015

Visual F# 2015 00322-80000-00000-AA896
Microsoft Visual F# 2015

Windows Phone SDK 8.0 - ENU 00322-80000-00000-AA896
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package 7.8.00927.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 14.1.20907.0
ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
For additional information, visit http://www.asp.net/

Azure App Service Tools v2.8.1 14.0.11123.0
Azure App Service Tools v2.8.1

Command Bus, Event Stream and Async Manager Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools 1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GitHub.VisualStudio 1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Image Optimizer 3.6.94
Uses industry standard tools to optimize any JPEG, PNG and Gifs - including animated Gifs. Can do both lossy and lossless optimization.

JavaScript Language Service 2.0
JavaScript Language Service

JavaScript Project System 2.0
JavaScript Project System

Microsoft .NET Core Tools (Preview 2) 14.1.20907.0
Microsoft .NET Core Tools (Preview 2)

Microsoft Azure Mobile Services Tools 1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager 3.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

ResXManager 1.0.0.88
Manage localization of all ResX-Based resources in one place. Shows all resources of a solution and let's you edit the strings and their localizations in a well-arranged data grid.

SQL Server Data Tools 14.0.60519.0
Microsoft SQL Server Data Tools

T4 Toolbox 14.0.0.0
Extends code generation capabilities of Text Templates.

TypeScript 1.8.36.0
TypeScript tools for Visual Studio

Visual F# Power Tools 2.5.0
A collection of additional commands for F# in Visual Studio

Visual Studio Tools for Universal Windows Apps 14.0.25527.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Web Essentials 2015.3 3.0.235
Adds many useful features to Visual Studio for web developers. Requires Visual Studio 2015

Xamarin 4.2.0.703 (3b7df6f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android 7.0.1.3 (96c7ba6)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS 10.0.1.10 (ad1cd42)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 5 Marek Habersack 2016-10-13 12:46:36 UTC
@jonp, looks like it might be an issue with the GC bridge as per comment 3?
Comment 6 Yann ROBIN 2016-11-03 15:17:21 UTC
Any update ?
Comment 7 Andy 2016-11-16 09:08:14 UTC
I'm also encountering this issue.  Can we have an update please?
Comment 8 Daniel 2016-12-19 08:40:55 UTC
I think I'm experiencing the same issue. I reported a new bug before I saw this one (https://bugzilla.xamarin.com/show_bug.cgi?id=50210). I've added an example project  to the bug I created where I can reproduce the issue every time by following the steps that I mention.
Comment 9 Anton Morozov 2017-02-15 10:23:43 UTC
The bug is caused by ModernHttp setting a Java exception into a Task.

See this comment in in ModernHttp repo: 
https://github.com/paulcbetts/ModernHttpClient/issues/229?_pjax=%23js-repo-pjax-container#issuecomment-253214125

Changing 
> tcs.TrySetException(javaEx);
to
> tcs.TrySetException(new WebException(javaEx.Message));
solves it.

Note You need to log in before you can comment on or make changes to this bug.