Crash on [NSURLConnection releaseDelegate] in a function without NSURLConnections, how do I culprit? - iphone

Hullo,
I am experimenting a very vicious crash that shows up in the following way in the device logs:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x50000008
Crashed Thread: 0`
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x33b24c98 objc_msgSend + 16
1 Foundation 0x3429465a _NSURLConnectionReleaseClient + 30
2 CFNetwork 0x355ac608 ClientContextHolder<CFURLConnectionClient_V4>::forget() + 20
3 CFNetwork 0x355ac5ea URLConnectionClient::releaseClientLocked() + 34
4 CFNetwork 0x355a0e9a URLConnectionClient::processEvents() + 170
5 CFNetwork 0x355a0de2 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
6 CFNetwork 0x355a0d54 MultiplexerSource::perform() + 120
7 CFNetwork 0x355a0cd2 MultiplexerSource::_perform(void*) + 2
8 CoreFoundation 0x3039ca72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
9 CoreFoundation 0x3039e758 __CFRunLoopDoSources0 + 376
10 CoreFoundation 0x3039f4e4 __CFRunLoopRun + 224
11 CoreFoundation 0x3032febc CFRunLoopRunSpecific + 224
12 CoreFoundation 0x3032fdc4 CFRunLoopRunInMode + 52
13 GraphicsServices 0x35571418 GSEventRunModal + 108
14 GraphicsServices 0x355714c4 GSEventRun + 56
15 UIKit 0x358c7d62 -[UIApplication _run] + 398
16 UIKit 0x358c5800 UIApplicationMain + 664
17 inArrivo 0x000023ca main (main.m:14)
18 inArrivo 0x00002394 start + 32
After having enabled NSZombie I also have a crash on the compiler log of the following form:
2011-05-09 16:12:24.400 inArrivo[5019:707] * -[NSURLConnection releaseDelegate]: message sent to deallocated instance 0x5d61670
appearing on the app main with the last NSLog comeing from a function with no url connections. Also if I remove some pieces of very innocent code from that function, no crash occurs, and the same happens when I run the complete application on the simulator.
Could someone give me some hints about what I may do to locate the piece of code producing the crash? Normal debugging of course is of little help here.
Thanks,
Fabrizio Bartolomucci

The message indicates that the delegate for NSURLConnection was deallocated. I would suggest you check the delegate object to see if you are doing an extra release on it.

Related

EXEC_BAD_ACCESS Error [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I set up NSZombieEnabled in Xcode 4?
I am debugging an application and it throws an exec-bad-access error when performing a certain navigation function but only when i run it on a device.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xf0000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3421bf78 objc_msgSend + 16
1 UIKit 0x31d9a28c -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 68
2 CoreFoundation 0x321ce7dc __invoking___ + 60
3 CoreFoundation 0x321297aa -[NSInvocation invoke] + 154
4 CoreFoundation 0x321293c8 -[NSInvocation invokeWithTarget:] + 44
5 WebKit 0x365f6e06 -[_WebSafeForwarder forwardInvocation:] + 246
6 CoreFoundation 0x321cda7c ___forwarding___ + 660
7 CoreFoundation 0x32128648 _CF_forwarding_prep_0 + 40
8 CoreFoundation 0x321ce7dc __invoking___ + 60
9 CoreFoundation 0x321297aa -[NSInvocation invoke] + 154
10 WebCore 0x358fa1ee _ZL11SendMessageP12NSInvocation + 18
11 WebCore 0x3590d6ea _ZL20HandleDelegateSourcePv + 74
12 CoreFoundation 0x3219facc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8
13 CoreFoundation 0x3219f298 __CFRunLoopDoSources0 + 208
14 CoreFoundation 0x3219e03e __CFRunLoopRun + 646
15 CoreFoundation 0x3212149e CFRunLoopRunSpecific + 294
16 CoreFoundation 0x32121366 CFRunLoopRunInMode + 98
17 GraphicsServices 0x31278432 GSEventRunModal + 130
18 UIKit 0x31c20cce UIApplicationMain + 1074
19 Parliament 0x0007396a main (main.m:14)
20 Parliament 0x00073928 start + 32
This is the error log. Would anyone know why this is or how i could debug errors such as this since running thruogh an instrument doesnt hep
You possibly have released an object and subsequently try to access that object in your webView:decidePolicyForNavigationAction delegate method.
Enable "Zombie" detection in your debug build settings:
How do I set up NSZombieEnabled in Xcode 4?
This will help you identify if an object is not being properly retained.

iPhone crash log - what is the reason?

I don't have much information when did it happened, because it didn't happened on my watch.
Anyone understand what was the reason?
Crash Log:
OS Version: iPhone OS 5.0 (9A334)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x80624913
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x37c38fbc objc_msgSend + 16
1 UIKit 0x32bc8cec -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded] + 128
2 UIKit 0x0061d7ee -[UIScrollViewAccessibility(SafeCategory) _scrollViewAnimationEnded] + 358
3 CoreFoundation 0x309f8224 -[NSObject performSelector:withObject:] + 36
4 UIKit 0x32b84c2a -[UIAnimator stopAnimation:] + 606
5 UIKit 0x32b845d4 -[UIAnimator(Static) _advance:withTimestamp:] + 260
6 UIKit 0x32b844c6 -[UIAnimator(Static) _LCDHeartbeatCallback:] + 46
7 QuartzCore 0x3219a41c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 160
8 QuartzCore 0x3219a372 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 54
9 IOMobileFramebuffer 0x3577ff8c IOMobileFramebufferVsyncNotifyFunc + 76
10 IOKit 0x31d2d88a IODispatchCalloutFromCFMessage + 182
11 CoreFoundation 0x30a62f3c __CFMachPortPerform + 356
12 CoreFoundation 0x30a6d54c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
13 CoreFoundation 0x30a6d4ee __CFRunLoopDoSource1 + 134
14 CoreFoundation 0x30a6c33c __CFRunLoopRun + 1364
15 CoreFoundation 0x309ef4d6 CFRunLoopRunSpecific + 294
16 CoreFoundation 0x309ef39e CFRunLoopRunInMode + 98
17 GraphicsServices 0x3361dfe6 GSEventRunModal + 150
18 UIKit 0x32a6173c UIApplicationMain + 1084
19 MyApp 0x00002304 0x1000 + 4868
20 MyApp 0x00002298 0x1000 + 4760
Looks like a segmentation fault. It seems like (just by observing the trace) there's some memory issue going on when the UIScrollView finishes a scroll animation. Have you tried enabling NSZombies or putting a breakpoint that catches any kind of exception? I know you said it didn't happen on your watch, but if you could get a brief description of where it happened, maybe you can attempt to replicate it while debugging it in Xcode.

Rejected iPhone app has strange crash logs

My app was rejected from the app store due to a crash that produced the crash log below. What is even more strange than the crash is that the steps given to reproduce it don't happen to me or any of 10+ beta testers (on differing iOS devices). Can anyone help explain this more? I know the exception codes are some sort of memory thing, but is that the only reason that could cause this crash log? For instance, I don't even get a line number.
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x33bd52d4 __kill + 8
1 libSystem.B.dylib 0x33bd52c4 kill + 4
2 libSystem.B.dylib 0x33bd52b6 raise + 10
3 libSystem.B.dylib 0x33be9d72 abort + 50
4 libstdc++.6.dylib 0x31bdba20 __gnu_cxx::__verbose_terminate_handler() + 376
5 libobjc.A.dylib 0x3347c594 _objc_terminate + 104
6 libstdc++.6.dylib 0x31bd9df2 __cxxabiv1::__terminate(void (*)()) + 46
7 libstdc++.6.dylib 0x31bd9e46 std::terminate() + 10
8 libstdc++.6.dylib 0x31bd9f16 __cxa_throw + 78
9 libobjc.A.dylib 0x3347b4c4 objc_exception_throw + 64
10 Foundation 0x33639910 __NSThreadPerformPerform + 648
11 CoreFoundation 0x33a767d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
12 CoreFoundation 0x33a485b0 __CFRunLoopDoSources0 + 376
13 CoreFoundation 0x33a47e54 __CFRunLoopRun + 224
14 CoreFoundation 0x33a47c80 CFRunLoopRunSpecific + 224
15 CoreFoundation 0x33a47b88 CFRunLoopRunInMode + 52
16 GraphicsServices 0x33b0e4a4 GSEventRunModal + 108
17 GraphicsServices 0x33b0e550 GSEventRun + 56
18 UIKit 0x32099322 -[UIApplication _run] + 406
19 UIKit 0x32096e8c UIApplicationMain + 664
20 AppName 0x00002172 main (main.m:14)
21 AppName 0x0000213c start + 32
Your code threw an un-handled exception somewhere or called abort() for some reason. It looks like it's happening in a dispatch to the main thread (so somewhere you are calling something like [obj performSelectorOnMainThread:#selector(something:) withObject:nil] or something similar. My best guess is that the selector you're choosing doesn't exist on the object (either due to memory management issues, like the object was replaced by something else) or due to some dynamic assignment you're doing.

App Crashing in NSURLConnection

I am trying to figure out what is causing this crash. I have built and given the app to our testers but we cannot seem to reproduce this reliably. It just happens sometimes...
Thread 0 Crashed:
0 libobjc.A.dylib 0x000027da objc_msgSend + 18
1 Foundation 0x00032896 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 62
2 Foundation 0x00032818 _NSURLConnectionDidFinishLoading + 72
3 CFNetwork 0x00010dd8 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 160
4 CFNetwork 0x00004ad4 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 96
5 CFNetwork 0x000049c4 URLConnectionClient::processEvents() + 64
6 CFNetwork 0x00004976 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
7 CFNetwork 0x000048f4 MultiplexerSource::perform() + 120
8 CFNetwork 0x00004872 MultiplexerSource::_perform(void*) + 2
9 CoreFoundation 0x00055f1e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
10 CoreFoundation 0x00027ba0 __CFRunLoopDoSources0 + 376
11 CoreFoundation 0x00027444 __CFRunLoopRun + 224
12 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224
13 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52
14 GraphicsServices 0x000045ec GSEventRunModal + 108
15 GraphicsServices 0x00004698 GSEventRun + 56
16 UIKit 0x0000411c -[UIApplication _run] + 396
17 UIKit 0x00002128 UIApplicationMain + 664
18 myapp 0x000020d8 main (main.m:14)
19 myapp 0x0000208c start + 32
Any advice would be greatly appreciated. The app is built in XCode 3.2.4 using SDK 4.1.
Cheers...
I would try turning on NSZombieEnabled and see if that sheds any light on the issue. Is the delegate for the connection still around and valid?
Ben has some sound advice. Turn NSZombieEnabled to on.
I can tell you with almost 100% certainty that it is crashing because you have a nil object when the delegate is attempting to send it a message.
The fact that it is only crashing sometimes, tells me that you are probably using autorelease. Autorelease never decrements the retain count at exactly the same time, so sometimes your object will still be alive when it gets a delegate message and the app works. However, sometimes that object will have been released and the app crashes.

iPhone: App crash in MapView after 20 min

I am working on an app that tracks a users location. After about 20 minutes it seems that the app always crashes, and I am not sure why. Device logs show:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x069f6000
Crashed Thread: 0
Thread 0 Crashed:
0 Ride 0x00012e00 -[Route addCoordinate:] (Route.m:92)
1 Ride 0x0000877a -[MyRidesMapViewController locationManager:didUpdateToLocation:fromLocation:] (MyRidesMapViewController.m:528)
2 CoreLocation 0x0000931c -[CLLocationManager onClientEventLocation:] + 584
3 CoreLocation 0x00007552 -[CLLocationManager onClientEvent:supportInfo:] + 98
4 CoreLocation 0x000076a0 OnClientEvent + 16
5 CoreLocation 0x00002ade CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
6 CoreLocation 0x0000512c CLClientHandleDaemonDataLocation(__CLClient*, CLClientLocation const*, __CFDictionary const*) + 204
7 CoreLocation 0x0000528a CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 298
8 CoreFoundation 0x0006936a __CFMessagePortPerform + 242
9 CoreFoundation 0x00071aa4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
10 CoreFoundation 0x00073848 __CFRunLoopDoSource1 + 160
11 CoreFoundation 0x00074626 __CFRunLoopRun + 514
12 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
13 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
14 GraphicsServices 0x000036e8 GSEventRunModal + 108
15 GraphicsServices 0x00003794 GSEventRun + 56
16 UIKit 0x000062a0 -[UIApplication _run] + 396
17 UIKit 0x00004e10 UIApplicationMain + 664
18 Ride 0x00002a20 main (main.m:14)
19 Ride 0x000029d4 start + 32
Looks like I am trying to release something that has already been released, but what?! I have NSZombie enabled, and it does not seem to help.
It used to work, and I recently updated my class to use self. for anything that I synthesized, could this be the issue?
EDIT: I updated the error. It seems to be listing the line numbers for each line, but they do not seem to be helping to find the issue.
Do you have NSZombie enabled while you're running on the device? If so chances are you are running out of memory. As you know, NSZombie keeps released objects around so you can detect a double release.
Chances are you do have some memory issues though. Does the static analyzer show you anything? (shift-command-A).
Setting the location manager delegate to nil AND THEN releasing it fixed the crash for me.