Bug 16862 - HttpClient library causes hard crash - SIGTRAP at CFRetain
Summary: HttpClient library causes hard crash - SIGTRAP at CFRetain
Status: VERIFIED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.0.4.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: 7.2.1
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-12-17 19:29 UTC by Val Savvateev
Modified: 2014-03-21 08:10 UTC (History)
5 users (show)

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


Attachments
Sample Test 1 (8.62 KB, application/zip)
2014-03-21 07:50 UTC, Shruti
Details
Http Client Sample 2 (558.83 KB, application/zip)
2014-03-21 07:53 UTC, Shruti
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:
VERIFIED NOT_REPRODUCIBLE

Description Val Savvateev 2013-12-17 19:29:49 UTC
Occasionally our app is crashing due to this error inside HttpClient library. Here is the call stack:

Thread: Unknown Name (Crashed)
0	  CoreFoundation                     	0x2dccd7fc CFRetain + 104
1	  ClementineAppiOS                   	0x0025b068 wrapper_managed_to_native_MonoTouch_CoreFoundation_CFObject_CFRetain_intptr + 92
2	  ClementineAppiOS                   	0x0020c1f0 MonoTouch_CoreFoundation_CFString__ctor_intptr_bool + 60
3	  ClementineAppiOS                   	0x0020c1a8 MonoTouch_CoreFoundation_CFString__ctor_intptr + 40
4	  ClementineAppiOS                   	0x0084914c System_Net_Http_CFNetworkHandler_HandleHasBytesAvailableEvent_object_MonoTouch_CoreFoundation_CFStream_StreamEventArgs + 640
5	  ClementineAppiOS                   	0x001fe0d0 MonoTouch_CoreFoundation_CFStream_OnHasBytesAvailableEvent_MonoTouch_CoreFoundation_CFStream_StreamEventArgs + 64
6	  ClementineAppiOS                   	0x001fe318 MonoTouch_CoreFoundation_CFStream_OnCallback_MonoTouch_CoreFoundation_CFStreamEventType + 176
7	  ClementineAppiOS                   	0x001fe25c MonoTouch_CoreFoundation_CFStream_OnCallback_intptr_MonoTouch_CoreFoundation_CFStreamEventType_intptr + 140
8	  ClementineAppiOS                   	0x002662e4 wrapper_native_to_managed_MonoTouch_CoreFoundation_CFStream_OnCallback_intptr_MonoTouch_CoreFoundation_CFStreamEventType_intptr + 84
9	  CoreFoundation                     	0x2dd313e3 _signalEventSync + 119
10	 CoreFoundation                     	0x2dd3aa3b _cfstream_solo_signalEventSync + 199
11	 CoreFoundation                     	0x2dd31099 _CFStreamSignalEvent + 329
12	 CFNetwork                          	0x2d992a67 _ZN29CoreReadStreamCFStreamSupport19coreStreamReadEventEP16__CoreReadStreamm + 75
13	 CFNetwork                          	0x2d992a13 _ZN20CoreReadStreamClient25coreStreamEventsAvailableEm + 35
14	 CFNetwork                          	0x2da39193 _ZN14CoreStreamBase14_callClientNowEP16CoreStreamClient + 43
15	 CFNetwork                          	0x2d9927b7 _ZN14CoreStreamBase34_streamSetEventAndScheduleDeliveryEmh + 123
16	 CFNetwork                          	0x2d992663 _ZN14CoreStreamBase28_streamInterface_SignalEventEmPK13CFStreamError + 35
17	 CFNetwork                          	0x2d9b6879 _ZN14HTTPReadStream15selfSignalEventEmPK13CFStreamError + 345
18	 CFNetwork                          	0x2d9b5d43 _ZN14HTTPReadStream11streamEventEm + 167
19	 CFNetwork                          	0x2d992a13 _ZN20CoreReadStreamClient25coreStreamEventsAvailableEm + 35
20	 CFNetwork                          	0x2da39193 _ZN14CoreStreamBase14_callClientNowEP16CoreStreamClient + 43
21	 CFNetwork                          	0x2da391b3 ___ZN14CoreStreamBase34_streamSetEventAndScheduleDeliveryEmh_block_invoke + 23
22	 CFNetwork                          	0x2da3a337 ___ZNK17CoreSchedulingSet13_performAsyncEPKcU13block_pointerFvvE_block_invoke + 19
23	 CoreFoundation                     	0x2dcd2ea1 CFArrayApplyFunction + 37
24	 CFNetwork                          	0x2d9a0e05 _ZN19RunloopBlockContext7performEv + 165
25	 CFNetwork                          	0x2d9a0cd5 _ZN17MultiplexerSource7performEv + 221
26	 CFNetwork                          	0x2d9a0b65 _ZN17MultiplexerSource8_performEPv + 49
27	 CoreFoundation                     	0x2dd6af1f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
28	 CoreFoundation                     	0x2dd6a46d __CFRunLoopDoSources0 + 341
29	 CoreFoundation                     	0x2dd68bd7 __CFRunLoopRun + 631
30	 CoreFoundation                     	0x2dcd3471 CFRunLoopRunSpecific + 525
31	 CoreFoundation                     	0x2dcd3253 CFRunLoopRunInMode + 107
32	 Foundation                         	0x2e6c1697 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 255
33	 Foundation                         	0x2e6e122b -[NSRunLoop(NSRunLoop) runUntilDate:] + 87
34	 ClementineAppiOS                   	0x0025e7f8 wrapper_managed_to_native_MonoTouch_ObjCRuntime_Messaging_void_objc_msgSend_IntPtr_intptr_intptr_intptr + 108
35	 ClementineAppiOS                   	0x0020833c MonoTouch_Foundation_NSRunLoop_RunUntil_MonoTouch_Foundation_NSDate + 68
36	 ClementineAppiOS                   	0x006be02c Clementine_Core_HttpBackendClient_GetResponse_Clementine_Core_IClUser_System_Net_Http_HttpRequestMessage_string_ + 132
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-12-19 18:43:00 UTC
Is the call stack identical for all crashes?
Comment 4 Val Savvateev 2013-12-19 21:54:38 UTC
Yes, this part of the call stack is always the same.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2014-01-14 12:48:01 UTC
I've modified the code that crashes a little bit, protecting against NULL values. Hopefully it'll fix the crashes. If it doesn't, it's because of some sort of memory corruption, and we'll need a test case in order to track it down.

This fix will most likely be included in 7.0.7.

monotouch/master: 0e801fa1708976282b9505eeb4f4b35f484a10b7
Comment 6 Shruti 2014-03-21 07:50:32 UTC
Created attachment 6372 [details]
Sample Test 1
Comment 7 Shruti 2014-03-21 07:53:27 UTC
Created attachment 6373 [details]
Http Client Sample 2
Comment 8 Shruti 2014-03-21 08:10:51 UTC
As per my observation, I have verified this fix using sample application attached along here with of 'Sample Test 1' and ''Http Client Sample 2'.
In test application 'Sample Test 1', I have added System.Net.Http library to test it and launch it on device. It is working fine.
In test application ''Http Client Sample 2', this is sample project of httpClient. It is also successfully launched on device.


Environment Info :
XS 4.2.4 (build 32) 
 X.iOS 7.2.1.20
 iPhone 5S - 7.1.