anaisbetts / ModernHttpClient

HttpClient implementations that use platform-native HTTP clients for :rocket:
MIT License
657 stars 260 forks source link

SIGABRT after UnknownHostException #229

Closed lhaussknecht closed 1 week ago

lhaussknecht commented 8 years ago

After making an http a call while network is disconnected, I get an UnknownHostException (which can be catched). Now turning on wifi and making the second call results in a app crash, which cannot be catched.

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)

PureWeen commented 8 years ago

Hmm getting the same exception.... Been trying to hunt down random app crashes that started happening about a month ago after a Xamarin upgrade and finally was able to boil it down to this one as well...

I took a tombstone file and did an NDK-STACK against it and came up with what I pasted below... The tombstone file also has the same exception that @lhaussknecht posted

I'm a bit new to using ndk-stack so hopefully I did it correctly :-/

It's odd because I setup an empty project with ModernHttpclient and it works fine when the network is disconnected but on my main project it crashes... I removed ModernHttpclient completely from my main project and now it's not crashing at all..

Still trying to track down the difference between the fresh project and my own to see why one works with Modern and the other doesn't

signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Stack frame #00  pc 0003bc96  /system/lib/libc.so (tgkill+22)
Stack frame #01  pc 00000005  <unknown>
Stack frame #00  pc 0003c426  /system/lib/libc.so (__ioctl+22)
Stack frame #01  pc ffffffff  <unknown>
Stack frame #02  pc 00000bb6  <unknown>
Stack frame #03  pc 00000008  <unknown>
Stack frame #04  pc 0003bfaf  /system/lib/libbinder.so
Stack frame #05  pc 00012eaf  /system/lib/libutils.so
Stack frame #06  pc 00012ebf  /system/lib/libutils.so
Stack frame #07  pc ffffffff  <unknown>
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 0000845f  [heap]
Stack frame #00  pc 0003d66b  /system/lib/libc.so (__rt_sigtimedwait+27)
Stack frame #01  pc 000fcc97  [stack:3003]
Stack frame #00  pc 0003c610  /system/lib/libc.so (select+32)
Stack frame #01  pc 00000028  <unknown>
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 00072193  /system/lib/libdvm.so
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 0000162f  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 00001f8f  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 000028ef  [heap]
Stack frame #00  pc 0003c426  /system/lib/libc.so (__ioctl+22)
Stack frame #01  pc 0000413f  [heap]
Stack frame #00  pc 0003c426  /system/lib/libc.so (__ioctl+22)
Stack frame #01  pc 00004f3f  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 00008ebb  <unknown>
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #00  pc 0003d8c3  /system/lib/libc.so (recvfrom+19)
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 00549c0f  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 005703df  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 0001dd4b  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 0000947b  <unknown>
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 00f3493b  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 0001e71f  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 0001e6db  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 023f513f  [heap]
Stack frame #00  pc 0003e179  /system/lib/libc.so (__futex_syscall4+25)
Stack frame #01  pc 00f3493b  [heap]
lhaussknecht commented 8 years ago

I opened an issue in Xamarin's bugtracker, because this error only appears in Xamarin cycle 8. https://bugzilla.xamarin.com/show_bug.cgi?id=45003

Downgrading to latest cycle 7 (Xamarin.VisualStudio_4.1.2.18.msi in my case) fixed the problem. I'm not sure that someone from ModernHttpClient can do much about it.

PureWeen commented 8 years ago

Yea I saw that and the response of NEEDINFO :-/ That's what I was trying to create a sample for but so far I haven't been successful.. I think the issue might more be with OkHttp but that's just a wild guess... The only way I've been able to sort of simulate the issue is if I create lots of overlapping requests if the network is disconnected

So just kicking off a bunch of these

Task.Run(async () =>
                {
                    try
                    {
                        await theClient.GetAsync("");
                    }
                    catch (Exception exc)
                    {
                    }
                });
                Task.Run(async () =>
                {
                    try
                    {
                        await theClient.GetAsync("");
                    }
                    catch (Exception exc)
                    {
                    }
                });

If I'm connected to wifi or I don't use Modern then it just trucks along. But if I disconnect from my network eventually I get things like this...

[mono-rt] Stacktrace:
[mono-rt] 
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_vector (intptr,intptr,intptr) <0x00043>
[mono-rt]   at (wrapper alloc) object.AllocVector (intptr,intptr) <IL 0x0008a, 0x001cf>
[mono-rt]   at System.Text.StringBuilder.ExpandByABlock (int) [0x00080] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs:1992
[mono-rt]   at System.Text.StringBuilder.Append (char*,int) [0x0008e] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs:1693
[mono-rt]   at System.Text.StringBuilder.AppendHelper (string) [0x0000b] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs:678
[mono-rt]   at System.Text.StringBuilder.Append (string) [0x0008c] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs:666
[mono-rt]   at string.Join (string,System.Collections.Generic.IEnumerable`1<string>) [0x0004e] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/string.cs:177
[mono-rt]   at ModernHttpClient.NativeMessageHandler/<SendAsync>c__async0.MoveNext () [0x00218] in /Users/paul/code/paulcbetts/modernhttpclient/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs:109
[mono-rt]   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.Net.Http.HttpResponseMessage>.Start<ModernHttpClient.NativeMessageHandler/<SendAsync>c__async0> (ModernHttpClient.NativeMessageHandler/<SendAsync>c__async0&) [0x00031] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471
[mono-rt]   at ModernHttpClient.NativeMessageHandler.SendAsync (System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken) <IL 0x0002e, 0x00197>
[mono-rt]   at System.Net.Http.HttpMessageInvoker.SendAsync (System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken) [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpMessageInvoker.cs:68
[mono-rt]   at System.Net.Http.HttpClient.<SendAsync>__BaseCallProxy0 (System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken) <IL 0x00003, 0x00067>
[mono-rt]   at System.Net.Http.HttpClient/<SendAsyncWorker>c__async0.MoveNext () [0x00071] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:272
[mono-rt]   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.Net.Http.HttpResponseMessage>.Start<System.Net.Http.HttpClient/<SendAsyncWorker>c__async0> (System.Net.Http.HttpClient/<SendAsyncWorker>c__async0&) [0x00031] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471
[mono-rt]   at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage,System.Net.Http.HttpCompletionOption,System.Threading.CancellationToken) <IL 0x00036, 0x001af>
[mono-rt]   at System.Net.Http.HttpClient.SendAsync (System.Net.Http.HttpRequestMessage,System.Net.Http.HttpCompletionOption,System.Threading.CancellationToken) [0x000e7] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:264
[mono-rt]   at System.Net.Http.HttpClient.SendAsync (System.Net.Http.HttpRequestMessage) [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:226
[mono-rt]   at System.Net.Http.HttpClient.GetAsync (string) [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:146
[mono-rt]   at ALoadTestXamFormss.MyPage/<>c__DisplayClass0_0/<<-ctor>b__3>d.MoveNext () [0x00018] in D:\Documents\SkyDrive\Xamarin2\ALoadTestXamFormss\ALoadTestXamFormss\MyPage.xaml.cs:45
[mono-rt]   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<TStateMachine_REF> (TStateMachine_REF&) [0x00031] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316
[mono-rt]   at ALoadTestXamFormss.MyPage/<>c__DisplayClass0_0.<.ctor>b__3 () <IL 0x0002a, 0x001bf>
[mono-rt]   at System.Threading.Tasks.Task`1<TResult_REF>.InnerInvoke () [0x00012] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:680
[mono-rt]   at System.Threading.Tasks.Task.Execute () [0x00016] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502
[mono-rt]   at System.Threading.Tasks.Task.ExecutionContextCallback (object) [0x00007] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2865
[mono-rt]   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
[mono-rt]   at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
[mono-rt]   at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task&) [0x0005f] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2827
[mono-rt]   at System.Threading.Tasks.Task.ExecuteEntry (bool) [0x0006f] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2760
[mono-rt]   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2707
[mono-rt]   at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:854
[mono-rt]   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1209
[mono-rt]   at (wrapper runtime-invoke) <Module>.runtime_invoke_bool (object,intptr,intptr,intptr) <IL 0x0001f, 0x0007b>
[mono-rt] 
[mono-rt] Attempting native Android stacktrace:
[mono-rt] 
[libc] Fatal signal 7 (SIGBUS), code 2, fault addr 0x9afbd000 in tid 10145 (Thread-24446)
[Mono] GC_BRIDGE waiting for bridge processing to finish

or this

10-07 12:52:09.770 8735-8868/com.companyname.aloadtestxamformss D/Mono: GC_BRIDGE waiting for bridge processing to finish
10-07 12:52:09.773 8735-9579/com.companyname.aloadtestxamformss E/mono-rt: Stacktrace:
10-07 12:52:09.773 8735-9579/com.companyname.aloadtestxamformss E/mono-rt: Attempting native Android stacktrace:
10-07 12:52:09.787 8735-9579/com.companyname.aloadtestxamformss E/mono-rt:  at ???+0 [0x70c4ef50]
10-07 12:52:09.844 8735-9579/com.companyname.aloadtestxamformss E/mono-rt:  at ???+0 [0xdead431f]
10-07 12:52:09.856 8735-9579/com.companyname.aloadtestxamformss E/mono-rt: =================================================================
                                                                           Got a SIGSEGV while executing native code. This usually indicates
                                                                           a fatal error in the mono runtime or one of the native libraries 
                                                                           used by your application.
                                                                           =================================================================
10-07 12:52:09.857 8735-9579/com.companyname.aloadtestxamformss A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdead4321 in tid 9579 (Thread-24384)

For now I've removed Modern and we are seeing no more app crashes.

Unfortunately Modern currently can't be compiled against the latest Mono https://github.com/paulcbetts/ModernHttpClient/issues/216

so not sure if something else more sinister has also fallen out of sync

The version you said is working for you has Mono Framework 4.4 where as the versions after have 4.6 ... There were some changes to TLS in 4.6 http://www.mono-project.com/docs/about-mono/releases/4.6.0/

Not sure if that relates :-)

lhaussknecht commented 8 years ago

I'm currently on vacation and had no chance to supply something for NEEDINFO...

We need to use mordern, because of the lack of TLS 1.2 support in the Mono implementation.

When I'm back I'll try to run some tests in my environment.

2016-10-07 21:17 GMT+02:00 Shane Neuville notifications@github.com:

Yea I saw that and the response of NEEDINFO :-/ That's what I was trying to create a sample for but so far I haven't been successful.. I think the issue might more be with OkHttp but that's just a wild guess... The only way I've been able to sort of simulate the issue is if I create lots of overlapping requests if the network is disconnected

So just kicking off a bunch of these

Task.Run(async () => { try { await theClient.GetAsync(""); } catch (Exception exc) { } }); Task.Run(async () => { try { await theClient.GetAsync(""); } catch (Exception exc) { } });

If I'm connected to wifi or I don't use Modern then it just trucks along. But if I disconnect from my network eventually I get things like this...

[mono-rt] Stacktrace: [mono-rt] [mono-rt] at <0xffffffff> [mono-rt] at (wrapper managed-to-native) object.icall_wrapper_mono_gc_alloc_vector (intptr,intptr,intptr) <0x00043> [mono-rt] at (wrapper alloc) object.AllocVector (intptr,intptr) <IL 0x0008a, 0x001cf> [mono-rt] at System.Text.StringBuilder.ExpandByABlock (int) [0x00080] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs:1992 [mono-rt] at System.Text.StringBuilder.Append (char*,int) [0x0008e] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs:1693 [mono-rt] at System.Text.StringBuilder.AppendHelper (string) [0x0000b] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs:678 [mono-rt] at System.Text.StringBuilder.Append (string) [0x0008c] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs:666 [mono-rt] at string.Join (string,System.Collections.Generic.IEnumerable1<string>) [0x0004e] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/string.cs:177 [mono-rt] at ModernHttpClient.NativeMessageHandler/<SendAsync>c__async0.MoveNext () [0x00218] in /Users/paul/code/paulcbetts/modernhttpclient/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs:109 [mono-rt] at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start<ModernHttpClient.NativeMessageHandler/casync0> (ModernHttpClient.NativeMessageHandler/casync0&) [0x00031] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471 [mono-rt] at ModernHttpClient.NativeMessageHandler.SendAsync (System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken) <IL 0x0002e, 0x00197> [mono-rt] at System.Net.Http.HttpMessageInvoker.SendAsync (System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken) [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpMessageInvoker.cs:68 [mono-rt] at System.Net.Http.HttpClient.BaseCallProxy0 (System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken) <IL 0x00003, 0x00067> [mono-rt] at System.Net.Http.HttpClient/casync0.MoveNext () [0x00071] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:272 [mono-rt] at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start<System.Net.Http.HttpClient/casync0> (System.Net.Http.HttpClient/casync0&) [0x00031] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471 [mono-rt] at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage,System.Net.Http.HttpCompletionOption,System.Threading.CancellationToken) <IL 0x00036, 0x001af> [mono-rt] at System.Net.Http.HttpClient.SendAsync (System.Net.Http.HttpRequestMessage,System.Net.Http.HttpCompletionOption,System.Threading.CancellationToken) [0x000e7] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:264 [mono-rt] at System.Net.Http.HttpClient.SendAsync (System.Net.Http.HttpRequestMessage) [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:226 [mono-rt] at System.Net.Http.HttpClient.GetAsync (string) [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:146 [mono-rt] at ALoadTestXamFormss.MyPage/<>c__DisplayClass0_0/<<-ctor>b3>d.MoveNext () [0x00018] in D:\Documents\SkyDrive\Xamarin2\ALoadTestXamFormss\ALoadTestXamFormss\MyPage.xaml.cs:45 [mono-rt] at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start (TStateMachine_REF&) [0x00031] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316 [mono-rt] at ALoadTestXamFormss.MyPage/<>c__DisplayClass0_0.<.ctor>b__3 () <IL 0x0002a, 0x001bf> [mono-rt] at System.Threading.Tasks.Task`1.InnerInvoke () [0x00012] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:680 [mono-rt] at System.Threading.Tasks.Task.Execute () [0x00016] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502 [mono-rt] at System.Threading.Tasks.Task.ExecutionContextCallback (object) [0x00007] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2865 [mono-rt] at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957 [mono-rt] at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904 [mono-rt] at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task&) [0x0005f] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2827 [mono-rt] at System.Threading.Tasks.Task.ExecuteEntry (bool) [0x0006f] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2760 [mono-rt] at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2707 [mono-rt] at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:854 [mono-rt] at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in /Users/builder/data/lanes/3819/96c7ba6c/source/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1209 [mono-rt] at (wrapper runtime-invoke) .runtime_invoke_bool (object,intptr,intptr,intptr) <IL 0x0001f, 0x0007b> [mono-rt] [mono-rt] Attempting native Android stacktrace: [mono-rt] [libc] Fatal signal 7 (SIGBUS), code 2, fault addr 0x9afbd000 in tid 10145 (Thread-24446) [Mono] GC_BRIDGE waiting for bridge processing to finish

or this

10-07 12:52:09.770 8735-8868/com.companyname.aloadtestxamformss D/Mono: GC_BRIDGE waiting for bridge processing to finish 10-07 12:52:09.773 8735-9579/com.companyname.aloadtestxamformss E/mono-rt: Stacktrace: 10-07 12:52:09.773 8735-9579/com.companyname.aloadtestxamformss E/mono-rt: Attempting native Android stacktrace: 10-07 12:52:09.787 8735-9579/com.companyname.aloadtestxamformss E/mono-rt: at ???+0 [0x70c4ef50] 10-07 12:52:09.844 8735-9579/com.companyname.aloadtestxamformss E/mono-rt: at ???+0 [0xdead431f] 10-07 12:52:09.856 8735-9579/com.companyname.aloadtestxamformss E/mono-rt: ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

10-07 12:52:09.857 8735-9579/com.companyname.aloadtestxamformss A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdead4321 in tid 9579 (Thread-24384)

For now I've removed Modern and we are seeing no more app crashes.

Unfortunately Modern currently can't be compiled against the latest Mono

216 https://github.com/paulcbetts/ModernHttpClient/issues/216

so not sure if something else more sinister has also fallen out of sync

The version you said is working for you has Mono Framework 4.4 where as the versions after have 4.6 ... There were some changes to TLS in 4.6 http://www.mono-project.com/docs/about-mono/releases/4.6.0/

Not sure if that relates :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/paulcbetts/ModernHttpClient/issues/229#issuecomment-252338171, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIjc1xwGqkGEqk7jCM3H2FD_2Wsm9svks5qxprPgaJpZM4KKG4z .

PureWeen commented 8 years ago

Aw ok

It looks like recent mono has brought TLS 1.2 to the table http://tirania.org/blog/archive/2016/Sep-30.html

http://www.mono-project.com/docs/about-mono/releases/4.6.0/

And through android you can use var client = new HttpClient ( new Xamarin.Android.Net.AndroidClientHandler ());

to Get TLS 1.2 https://developer.xamarin.com/releases/android/xamarin.android_6/xamarin.android_6.1/

kYann commented 8 years ago

Hey !

I found why we have crash when okhttp throw exception : It starts here https://github.com/paulcbetts/ModernHttpClient/blob/master/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs#L184

When an exception occurs, it is set on the task. Then this exception is catch here : https://github.com/paulcbetts/ModernHttpClient/blob/master/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs#L130

And when accessing the Java exception, it fails with sigsev. I think the Java collector collected the exception and we are accessing a part of the memory that we souldn't.

What I did ; As I don't need the typed exception, I've replace the tcs.TrySetException(p1) with tcs.TrySetException(new WebException(p1.Message));

I'm gonna put my version on a fork and provide a nuget package

kYann commented 8 years ago

Hotfix branch https://github.com/Youscribe/ModernHttpClient/tree/hotfix/cycle8-issue

Nupkg is attached (rename to .nupkg) modernhttpclient.2.4.3.2.zip

kYann commented 8 years ago

I'm so sick of xamarin :'(

mikescandy commented 8 years ago

I confirm that this fix solves a number of random crashes I experienced in my app. A network exception thrown by modern would eventually crash the app somewhere else. Any chance somebody can merge the fix?

enantiomer2000 commented 7 years ago

I also am experiencing this problem. I am using VS Xamarin 4.2.1.64..

enantiomer2000 commented 7 years ago

Youscribe hotfix branch seems to address the crashes. Development of ModernHttpClient seems to be pretty stagnant. Is anybody going to merge the branch with the source?

SimpsOff commented 7 years ago

Xamarin does some things really well... but the added level and number of poorly maintained projects/bindings is really sad. Thanks @kYann for this fix, I'm trying now and hoping it fixes my issue.

Hopefully it will be merged into this soon?

david-laundav commented 7 years ago

+1. I'd really like to see this being merged as well. The solution is seemingly quite simple and straight forward.

Unfortunately, we can not downgrade to Cycle 7, as others have suggested, as we depend on Android Nougat (SDK 24) as our Target Platform which consequently requires Cycle 8.

Does anyone who are involved in this ticket know who we need to reach out to before this issue retrieves some attention?

lhaussknecht commented 7 years ago

We are using this fork, where a patch is implemented.

See: https://github.com/paulcbetts/ModernHttpClient/issues/229#issuecomment-253240817

2017-02-15 11:27 GMT+01:00 David Laundav notifications@github.com:

+1. I'd really like to see this being merged as well. The solution is seemingly quite simple and straight forward.

Unfortunately, we can not downgrade to Cycle 7, as others have suggested, as we depend on Android Nougat (SDK 24) as our Target Platform which consequently requires Cycle 8.

Does anyone who are involved in this ticket know who we need to reach out to before this issue retrieves some attention?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/paulcbetts/ModernHttpClient/issues/229#issuecomment-279973474, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIjcxKUxJVUdwk-ymTDfjaSMJnkXdO4ks5rctL2gaJpZM4KKG4z .

david-laundav commented 7 years ago

We are using this fork, where a patch is implemented.

See:

229 (comment)

This is unfortunately not a viable solution for us either due to maintainability. We have to use official resources (i.e. the NuGet Package Manager) as we're shipping an application which is utilised by million of users.

Does anyone know when an official update will be provided through the NuGet Package Manager?