Bug 36708 - Crash on WebCore: CFNetwork Loader
Summary: Crash on WebCore: CFNetwork Loader
Status: RESOLVED NORESPONSE
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 9.1 (iOS 9.1)
Hardware: PC Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2015-12-08 12:09 UTC by hana.iku
Modified: 2016-04-12 15:40 UTC (History)
3 users (show)

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


Attachments
Crash log (44.55 KB, text/plain)
2015-12-08 12:09 UTC, hana.iku
Details
Original crash log (46.83 KB, text/plain)
2015-12-08 17:06 UTC, hana.iku
Details


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:
Status:
RESOLVED NORESPONSE

Description hana.iku 2015-12-08 12:09:17 UTC
Created attachment 14182 [details]
Crash log

Some users are unable to use my app after they updated the iOS to 9.1, until now, all cases occurred on iPad 2 (iPad2,2). 
After the splash screen, the initial screen is briefly showed and the app crash.

Thread 14 name: WebCore: CFNetwork Loader
Thread 14 Crashed:
0 libsystem_kernel.dylib 0x37e28c84 0x37e14000 + 85124
1 libsystem_pthread.dylib 0x37ecc732 0x37ec8000 + 18226
2 libsystem_c.dylib 0x37dc0f20 0x37d76000 + 306976
3 AppName 0x00a9947e _mh_execute_header + 10208382
4 AppName 0x00a9d23c _mh_execute_header + 10224188
5 libsystem_platform.dylib 0x37ec6076 0x37ec1000 + 20598
6 libsystem_pthread.dylib 0x37ecc732 0x37ec8000 + 18226
7 libsystem_c.dylib 0x37dc0f20 0x37d76000 + 306976
8 AppName 0x00b38554 xamarin_get_block_descriptor + 5020
9 AppName 0x00a998da _mh_execute_header + 10209498
10 AppName 0x00aa3cfe _mh_execute_header + 10251518
11 AppName 0x00a990fc _mh_execute_header + 10207484
12 AppName 0x00a9822e _mh_execute_header + 10203694
13 AppName 0x00a92582 _mh_execute_header + 10179970
14 AppName 0x004dbe00 _mh_execute_header + 4189696
15 AppName 0x00136320 _mh_execute_header + 365344
16 AppName 0x004a5690 _mh_execute_header + 3966608
17 AppName 0x00aa3686 _mh_execute_header + 10249862
18 AppName 0x00ae37c0 _mh_execute_header + 10512320
19 AppName 0x00a61d90 _mh_execute_header + 9981328
20 AppName 0x00a6e54c _mh_execute_header + 10032460
21 CFNetwork 0x2531d40e 0x25237000 + 943118
22 CFNetwork 0x2524cccc 0x25237000 + 89292
23 libdispatch.dylib 0x37d0fbd6 0x37d0d000 + 11222
24 libdispatch.dylib 0x37d19186 0x37d0d000 + 49542
25 CFNetwork 0x2524ccae 0x25237000 + 89262
26 CoreFoundation 0x25950b50 0x25948000 + 35664
27 CFNetwork 0x2524cb96 0x25237000 + 88982
28 CFNetwork 0x2524ca60 0x25237000 + 88672
29 CFNetwork 0x2524c8f8 0x25237000 + 88312
30 CoreFoundation 0x259ffbfe 0x25948000 + 752638
31 CoreFoundation 0x259ff7ec 0x25948000 + 751596
32 CoreFoundation 0x259fdb5a 0x25948000 + 744282
33 CoreFoundation 0x25951118 0x25948000 + 37144
34 CoreFoundation 0x25950f04 0x25948000 + 36612
35 WebCore 0x34d9ed1c 0x34d24000 + 503068
36 JavaScriptCore 0x26e25640 0x26e1d000 + 34368
37 JavaScriptCore 0x26e2559e 0x26e1d000 + 34206
38 libsystem_pthread.dylib 0x37ecb85a 0x37ec8000 + 14426
39 libsystem_pthread.dylib 0x37ecb7ce 0x37ec8000 + 14286
40 libsystem_pthread.dylib 0x37ec9724 0x37ec8000 + 5924

Thread 14 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x00000000
r4: 0x00000006 r5: 0x1f7f3000 r6: 0x9c53e0e4 r7: 0x1f7f0d04
r8: 0x161e3e98 r9: 0x37ec604d r10: 0x00e250a3 r11: 0x161e3e00
ip: 0x00000148 sp: 0x1f7f0cf8 lr: 0x37ecc733 pc: 0x37e28c84
cpsr: 0x00000010

Xamarin Info:

=== Xamarin Studio ===

Version 5.10.1 (build 6)
Installation UUID: a3d8f9c7-57c1-4337-af04-f2f389fabe2c
Runtime:
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.0.1 (8228)
Build 7A1001

=== Xamarin.iOS ===

Version: 9.2.1.54 (Business Edition)
Hash: eb4c1ef
Branch: master
Build date: 2015-12-01 02:12:30-0500

=== Xamarin.Android ===

Version: 6.0.0.34 (Business Edition)
Android SDK: /Users/foster/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)

SDK Tools Version: 24.2
SDK Platform Tools Version: 22
SDK Build Tools Version: 20

Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 510010006
Git revision: 0b60eecdb531933734519c13257d16a780274aab
Build date: 2015-12-04 20:28:20-05
Xamarin addins: 9876fd7c9837977178411ec7375b4352c0a0d6af
Build lane: monodevelop-lion-cycle6-baseline

=== Operating System ===

Mac OS X 10.10.5
Darwin fmb-18414.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 1 hana.iku 2015-12-08 12:11:01 UTC
I forgot to add, I can't reproduce this problem.
Comment 2 Sebastien Pouliot 2015-12-08 15:22:05 UTC
Please attach a symbolicated crash report. Without symbols a crash report does not tell us much about what/where happened.

Do you have an iPad 2 ? 

If not can we get access to your app so we can run it on an iPad 2 ?
Comment 3 hana.iku 2015-12-08 17:06:47 UTC
Created attachment 14188 [details]
Original crash log
Comment 4 hana.iku 2015-12-08 17:15:23 UTC
The first file was symbolicated, now I uploaded the original without symbols, they don't have many differences. 

Yes, I have an iPad 2, but I can't reproduce this crash, maybe because I'm using a different model, I'm use a MC769BZ/A and the problem occurred in a MC984BZ/A.

An user said that after reseted all settings the app worked fine, but I can ask for all my clients do that.
Comment 5 Sebastien Pouliot 2015-12-09 00:37:44 UTC
The original crash report is not symbolicated properly (and does not show any of your application symbols, nor the ones from Xamarin's code). It's possible that the .dSYM you have does not match the binary you uploaded to Apple. Without that information we have no data to help you.

iOS isolate each applications so a "reset all settings" should never be required - unless you end up storing configuration that cause the crash in the keychain or in the cloud. In general deleting the app _should_ be enough.

That also hints that your issue might be configuration related - something is causing the execution to hit a code path that cause a crash, on an iPad2, with iOS 9.1. The configuration (being loaded at startup I assume) could be the key difference between your customers hitting the crash and you.
Comment 6 hana.iku 2015-12-09 11:45:23 UTC
The .dYSM and the crash log have the same UUID, maybe it's because the app was re-signed, I will ask the .ipa and I will try symbolicate it again.
Comment 7 hana.iku 2015-12-11 19:19:25 UTC
I found the error, after use the app and restart the device for x times, the follow code starts returns null on some iPad 2 3G* models with iOS 9.1 and NSUrlResponse return a unhandled exception, any idea why is this happening?

...
NSUrlResponse (url, GetMimeType (urlPath), -1, null)
...

[DllImport (Constants.MobileCoreServicesLibrary,EntryPoint="UTTypeCreatePreferredIdentifierForTag")]

public extern static IntPtr UTTypeCreatePreferredIdentifierForTag(IntPtr tagClass, IntPtr tag, IntPtr uti);

public static string GetMimeType(string path)
{
   var classRef = new NSString (UTType.TagClassMIMEType);
   var mimeRef = new NSString (System.IO.Path.GetExtension(path));
   var utiRef = UTTypeCreatePreferredIdentifierForTag (classRef.Handle, mimeRef.Handle, IntPtr.Zero);
   NSString uti = new NSString(Marshal.PtrToStringUni(utiRef));
   return uti;
}

* until now I can't reproduce the error on Wi-fi only model.
Comment 8 Sebastien Pouliot 2015-12-12 16:43:32 UTC
> NSUrlResponse return a unhandled exception

Can you provide the details of the exception (managed or native) ?

Also if you can reproduce locally then you have a much better change to have a locally (and correctly) symbolicated crash report.

> any idea why is this happening?

No, that's not something that should change between execution/app restart - unless the input is different ? i.e. is the extension (`Path.GetExtension(path)`) always the same value ?

If the output (for the same input) differs, like a crash, then it might be an iOS bug. We can try to reproduce this on our devices if you give us the input values (the `path` and `url`).


Also note that the above code could be replaced with a call to `UTType.CreatePreferredIdentifier`.

It would do a better job at handling (and releasing more quickly) memory and avoid the last (hidden by a type cast NSString/string alloc). Still this is unlikely to be the cause of your issue.
Comment 9 hana.iku 2015-12-14 12:51:36 UTC
> Can you provide the details of the exception (managed or native) ?

Unhandled managed exception:
Argument cannot be null.
Parameter name: mimetype (System.ArgumentNullException)
at Foundation.NSUrlResponse..ctor (Foundation.NSUrl url, System.String mimetype, nint expectedContentLength, System.String textEncodingName) [0x00000] in <filename unknown>:0 
at AppName.Util.FileLowerNameURLProtocol.StartLoading () [0x00000] in <filename unknown>:0

> i.e. is the extension (`Path.GetExtension(path)`) always the same value ?

Yes.

We can try to reproduce this on our devices if you give us the input values (the `path` and `url`).

/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/index.html
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/css/stylegeral.css
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/css/stylehome.css
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/css/swiper.min.css
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/images/aaa-aaa.jpg
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/images/bbbbbb.jpg
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/images/cccccc.jpg
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/images/aaa-aaa-aaa.jpg
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/images/aa-aaaaaa.jpg
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/js/swiper.min.js
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/fonts/helveticabd___-_0.otf
/var/mobile/Containers/Data/Application/9ACA8E58-DC46-4583-A958-95660621F579/Documents/news/fonts/helvetica neue_0.otf

I will change my code to use 'UTType.CreatePreferredIdentifier' and test.
Comment 10 Sebastien Pouliot 2015-12-14 21:29:16 UTC
Let me know your result. I'll write a test based on your both your data/code above and our method then ask QA to run them on their iPad 2.
Comment 11 Sebastien Pouliot 2015-12-15 18:57:07 UTC
@Gouri I added a unit test (monotouch-test.app) in maccore/master 299e5f1ea8f9351ca7bd765cf9c310a7c85f1b1f

When you have the chance can you run it on iPad2, in preference any 3G (not wifi), device you have in QA ? thanks!
Comment 12 Sebastien Pouliot 2016-01-13 20:21:03 UTC
@hana is the problem still reproducible using `'UTType.CreatePreferredIdentifier` ?

@Gouri did you had the chance to test this on QA's devices ?


note: moving off C7 milestone has we have no immediate data to work on.
Comment 13 Sebastien Pouliot 2016-04-12 15:40:16 UTC
We have not received further information and will assume this is not an issue anymore. If you can still affected by this please re-open the bug and include the requested information. Thanks.