pokeb / asi-http-request

Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone
http://allseeing-i.com/ASIHTTPRequest
Other
5.78k stars 1.41k forks source link

Crashing application in this line #389

Closed vivekCZ closed 9 years ago

vivekCZ commented 10 years ago

My app. target is ios7. My app getting crash at marked line in following code

TonnyXu commented 9 years ago

same here, I got about 1% of our users crash on this line. Also, the problem looks like limited to 32bit devices.

Any suggestions?

jogu commented 9 years ago

Do you have any more information? eg. a full symbolicated backtrace and the details of the exact way it's crashing?

TonnyXu commented 9 years ago

@jogu Unfortunately, we still don't known exactly how to reproduce this issue.

Also, another factor is that, in all the crashes, this thread always appears, but it's not the crashed thread:

Thread : Thread
0  libsystem_kernel.dylib         0x3900849c mach_msg_trap + 20
1  libsystem_kernel.dylib         0x39008295 mach_msg + 40
2  CoreFoundation                 0x2ad8c7fb __CFRunLoopServiceMachPort + 146
3  CoreFoundation                 0x2ad8adc1 __CFRunLoopRun + 1016
4  CoreFoundation                 0x2acd7b51 CFRunLoopRunSpecific + 476
5  CoreFoundation                 0x2acd7963 CFRunLoopRunInMode + 106
6  <my  app>                      0x001ceb4b +[ASIHTTPRequest runRequests] (ASIHTTPRequest.m:4797)
7  Foundation                     0x2bb004bb __NSThread__main__ + 1118
8  libsystem_pthread.dylib        0x3909adeb _pthread_body + 138
9  libsystem_pthread.dylib        0x3909ad5f _pthread_start + 118

And the crashed thread has all kinds of different queue names, but they all have some similar backtrace stack. Here are some samples:

Sample 1

Thread : Crashed: com.apple.libdispatch-manager
0  libsystem_kernel.dylib         0x3901bdf0 __pthread_kill + 8
1  libsystem_pthread.dylib        0x3909bc97 pthread_kill + 62
2  libsystem_c.dylib              0x38fba939 abort + 76
3  libsystem_malloc.dylib         0x3904d39b szone_error + 334
4  libsystem_malloc.dylib         0x3904d649 free_list_checksum_botch + 28
5  libsystem_malloc.dylib         0x39045475 tiny_malloc_from_free_list + 1004
6  libsystem_malloc.dylib         0x39043f7b szone_malloc_should_clear + 222
7  libsystem_malloc.dylib         0x39047447 malloc_zone_calloc + 94
8  libsystem_malloc.dylib         0x390473d7 calloc + 50
9  libdispatch.dylib              0x38f19df7 _dispatch_calloc + 22
10 libdispatch.dylib              0x38f2b8ad _dispatch_mach_reply_kevent_register + 24
11 libdispatch.dylib              0x38f28f91 _dispatch_mach_msg_send + 908
12 libdispatch.dylib              0x38f292cb _dispatch_mach_send_drain + 182
13 libdispatch.dylib              0x38f29af5 _dispatch_mach_invoke$VARIANT$mp + 216
14 libdispatch.dylib              0x38f22145 _dispatch_queue_drain$VARIANT$mp + 552
15 libdispatch.dylib              0x38f225ed _dispatch_mgr_queue_drain$VARIANT$mp + 36
16 libdispatch.dylib              0x38f28427 _dispatch_mgr_invoke + 78
17 libdispatch.dylib              0x38f28223 _dispatch_mgr_thread$VARIANT$mp + 38

Sample 2

Thread : Crashed: com.apple.network.helper_queue
0  libsystem_kernel.dylib         0x3a5541f0 __pthread_kill + 8
1  libsystem_pthread.dylib        0x3a5bc7b7 pthread_kill + 58
2  libsystem_c.dylib              0x3a504ff9 abort + 76
3  libsystem_malloc.dylib         0x3a582731 purgeable_ptr_in_use_enumerator
4  libsystem_malloc.dylib         0x3a5829ad free_list_checksum_botch + 28
5  libsystem_malloc.dylib         0x3a57abc1 tiny_malloc_from_free_list + 212
6  libsystem_malloc.dylib         0x3a5799ed szone_malloc_should_clear + 228
7  libsystem_malloc.dylib         0x3a57cc81 malloc_zone_calloc + 76
8  libsystem_malloc.dylib         0x3a57cc23 calloc + 50
9  libobjc.A.dylib                0x39fa6197 class_createInstance + 42
10 libdispatch.dylib              0x3a488d7b _os_object_alloc_realized + 22
11 libxpc.dylib                   0x3a5c698b _xpc_serializer_create + 22
12 libxpc.dylib                   0x3a5c691d _xpc_connection_pack_message + 16
13 libxpc.dylib                   0x3a5c7fd3 _xpc_connection_setup_reply_port + 26
14 libxpc.dylib                   0x3a5c7f81 xpc_connection_send_message_with_reply + 56
15 libsystem_network.dylib        0x3a5956cf __net_helper_send_block_invoke + 30
16 libdispatch.dylib              0x3a48d6c3 _dispatch_barrier_sync_f_invoke + 26
17 libsystem_network.dylib        0x3a593b15 net_helper_send + 168
18 libsystem_network.dylib        0x3a59490d net_helper_connection_start + 240
19 libsystem_network.dylib        0x3a591fdb tcp_connection_register_reachability + 174
20 libsystem_network.dylib        0x3a59110d __tcp_connection_start_block_invoke + 272
21 libdispatch.dylib              0x3a488d53 _dispatch_call_block_and_release + 10
22 libdispatch.dylib              0x3a48dcbd _dispatch_queue_drain + 488
23 libdispatch.dylib              0x3a48ac6f _dispatch_queue_invoke + 42
24 libdispatch.dylib              0x3a48e5f1 _dispatch_root_queue_drain + 76
25 libdispatch.dylib              0x3a48e8dd _dispatch_worker_thread2 + 56
26 libsystem_pthread.dylib        0x3a5b9c17 _pthread_wqthread + 298

Sample 3

Thread : Crashed: com.apple.assertiond.processassertionconnection
0  libsystem_kernel.dylib         0x39f93df0 __pthread_kill + 8
1  libsystem_pthread.dylib        0x3a011cc7 pthread_kill + 62
2  libsystem_c.dylib              0x39f2f909 abort + 76
3  libsystem_malloc.dylib         0x39fc43af szone_error + 334
4  libsystem_malloc.dylib         0x39fc4659 free_list_checksum_botch + 28
5  libsystem_malloc.dylib         0x39fbc0cb tiny_malloc_from_free_list + 202
6  libsystem_malloc.dylib         0x39fbaebb szone_malloc_should_clear + 222
7  libsystem_malloc.dylib         0x39fbe401 malloc_zone_calloc + 92
8  libsystem_malloc.dylib         0x39fbe393 calloc + 50
9  libobjc.A.dylib                0x39946411 class_createInstance + 40
10 libdispatch.dylib              0x39ea830b _os_object_alloc_realized + 22
11 libxpc.dylib                   0x3a025de5 _xpc_serializer_create_from_wire + 24
12 libxpc.dylib                   0x3a025d1d _xpc_connection_unpack_message + 52
13 libxpc.dylib                   0x3a0248f9 _xpc_connection_mach_event + 152
14 libdispatch.dylib              0x39eaaff7 _dispatch_mach_msg_invoke + 386
15 libdispatch.dylib              0x39eb0397 _dispatch_queue_drain + 554
16 libdispatch.dylib              0x39eaa7a1 _dispatch_mach_invoke + 96
17 libdispatch.dylib              0x39eb0397 _dispatch_queue_drain + 554
18 libdispatch.dylib              0x39eaaaad _dispatch_queue_invoke + 84
19 libdispatch.dylib              0x39eb1f9f _dispatch_root_queue_drain + 394
20 libdispatch.dylib              0x39eb33c3 _dispatch_worker_thread3 + 94
21 libsystem_pthread.dylib        0x3a00edc1 _pthread_wqthread + 668

Sample 4

Thread : Crashed: CTServerConnection.callback
0  libsystem_kernel.dylib         0x32f39df0 __pthread_kill + 8
1  libsystem_pthread.dylib        0x32fb7cc7 pthread_kill + 62
2  libsystem_c.dylib              0x32ed5909 abort + 76
3  libsystem_malloc.dylib         0x32f6a3af szone_error + 334
4  libsystem_malloc.dylib         0x32f6a659 free_list_checksum_botch + 28
5  libsystem_malloc.dylib         0x32f620cb tiny_malloc_from_free_list + 202
6  libsystem_malloc.dylib         0x32f60ebb szone_malloc_should_clear + 222
7  libsystem_malloc.dylib         0x32f64401 malloc_zone_calloc + 92
8  libsystem_malloc.dylib         0x32f64393 calloc + 50
9  libobjc.A.dylib                0x328ec411 class_createInstance + 40
10 libdispatch.dylib              0x32e4e30b _os_object_alloc_realized + 22
11 libxpc.dylib                   0x32fcbde5 _xpc_serializer_create_from_wire + 24
12 libxpc.dylib                   0x32fcbd1d _xpc_connection_unpack_message + 52
13 libxpc.dylib                   0x32fca8f9 _xpc_connection_mach_event + 152
14 libdispatch.dylib              0x32e50ff7 _dispatch_mach_msg_invoke + 386
15 libdispatch.dylib              0x32e56397 _dispatch_queue_drain + 554
16 libdispatch.dylib              0x32e507a1 _dispatch_mach_invoke + 96
17 libdispatch.dylib              0x32e56397 _dispatch_queue_drain + 554
18 libdispatch.dylib              0x32e50aad _dispatch_queue_invoke + 84
19 libdispatch.dylib              0x32e57f9f _dispatch_root_queue_drain + 394
20 libdispatch.dylib              0x32e593c3 _dispatch_worker_thread3 + 94
21 libsystem_pthread.dylib        0x32fb4dc1 _pthread_wqthread + 668
jogu commented 9 years ago

The ASIHTTPRequest thread will always appear in the crash logs because it is always running. This does not mean it is involved in the crash.

All the references to szone_error show that you have some kind of memory corruption going on. I do not believe that is related to ASIHTTPRequest.

Try enabling all the Xcode features for detecting memory corruption (nszombies, guards, etc). You can also breakpoint szone_error, and you should also see some console output from it.