开发者

Why did this app crash while in the background?

My app uses background location for GPS updates. I've registered it for background location updates, and while it's running in background, it always crashes like this.

Since I haven't written most of this code, I really have no idea what happened.

I have checked the memory allocations and there doesn't seem to be much of a problem there. Here's a crash report:

Incident Identifier: 39F6F622-1274-4B6C-BA19-32D10E04E309
CrashReporter Key:   4757f4c5e5f009daf18eb0c512f729356c3e5de4
Hardware Model:      iPhone3,1
Process:         Get Off Now! [3040]
Path:            /var/mobile/Applications/43D41F77-B225-4F47-AFB0-D2F2E00E18DF/Get Off Now!.app/Get Off Now!
Identifier:      Get Off Now!
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2010-12-22 13:31:29.293 +0800
OS Version:      iPhone OS 4.1 (8B117)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000d
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                 0x000027d8 objc_msgSend + 16
1   CoreFoundation                  0x000042ae CFRetain + 62
2   CoreFoundation                  0x0005ab58 CFMessagePortInvalidate + 304
3   CoreFoundation                  0x0005b05e CFMessagePortIsValid + 42
4   CoreLocation                    0x000030f8 CLClientIsValid + 12
5   CoreLocation                    0x00004b10 CLClientSendAndCache(__CLClient*, CLDaemonCommType, void*, int, unsigned char, unsigned char) + 40
6   CoreLocation                    0x000051cc CLClientHandleWatchdogTimerExpiry(__CFRunLoopTimer*, void*) + 24
7   CoreFoundation                  0x000567f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
8   CoreFoundation                  0x000562a6 __CFRunLoopDoTimer + 854
9   CoreFoundation                  0x0002779e __CFRunLoopRun + 1082
10  CoreFoundation                  0x00027270 CFRunLoopRunSpecific + 224
11  CoreFoundation                  0x00027178 CFRunLoopRunInMode + 52
12  GraphicsServices                0x000045ec GSEventRunModal + 108
13  GraphicsServices                0x00004698 GSEventRun + 56
14  UIKit                           0x0000411c -[UIApplication _run] + 396
15  UIKit                           0x00002128 UIApplicationMain + 664
16  Get Off Now!                    0x00002406 0x1000 + 5126
17  Get Off Now!                    0x000023d0 0x1000 + 5072

Thread 1:
0   libSystem.B.dylib               0x0002d330 kevent + 24
1   libSystem.B.dylib               0x000d6b6c _dispatch_mgr_invoke + 88
2   libSystem.B.dylib               0x000d65bc _dispatch_queue_invoke + 96
3   libSystem.B.dylib               0x000d675c _dispatch_worker_thread2 + 120
4   libSystem.B.dylib               0x0007a67a _pthread_wqthread + 258
5   libSystem.B.dylib               0x00073190 start_wqthread + 0

Thread 2:
0   libSystem.B.dylib               0x00000cf4 semaphore_wait_signal_trap + 8
1   libSystem.B.dylib               0x0002e4ee semaphore_wait_signal + 2
2   libSystem.B.dylib               0x00002ae4 pthread_mutex_lock + 248
3   WebCore                         0x00002620 _WebTryThreadLock(bool) + 140
4   WebCore                         0x00002566 WebRunLoopLock(__CFRunLoopObserver*, unsigned long, void*) + 18
5   CoreFoundation                  0x00030236 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 10
6   CoreFoundation                  0x000300aa __CFRunLoopDoObservers + 406
7   CoreFoundation                  0x000276c0 __CFRunLoopRun + 860
8   CoreFoundation                  0x00027270 CFRunLoopRunSpecific + 224
9   CoreFoundation                  0x00027178 CFRunLoopRunInMode + 52
10  WebCore                         0x000024e2 RunWebThread(void*) + 362
11  libSystem.B.dylib               0x0007a27e _pthread_start + 242
12  libSystem.B.dylib               0x0006f2a8 thread_start + 0

Thread 3:
0   libSystem.B.dylib               0x0007b19c __workq_kernreturn + 8
1   libSystem.B.dylib               0x0007a790 _pthread_wqthread + 536
2   libSystem.B.dylib               0x00073190 start_wqthread + 0

Thread 4:
0   libSystem.B.dylib      开发者_JS百科         0x0007b19c __workq_kernreturn + 8
1   libSystem.B.dylib               0x0007a790 _pthread_wqthread + 536
2   libSystem.B.dylib               0x00073190 start_wqthread + 0

Thread 0 crashed with ARM Thread State:
    r0: 0x001a01c0    r1: 0x33024270      r2: 0x00000005      r3: 0x3002d7c9
    r4: 0x00000005    r5: 0x3e1af5e4      r6: 0x00000017      r7: 0x2fffeac0
    r8: 0x00000004    r9: 0x001fc098     r10: 0x00855864     r11: 0x2fffeb48
    ip: 0x3e19c3f0    sp: 0x2fffeaa8      lr: 0x307fc2b5      pc: 0x3002d7d8
  cpsr: 0x20000030

This is another way it crashes; it looks the same, except it uses 100% CPU for a long time:

Incident Identifier: 61B42F36-021F-48D2-B180-112527BAE5CF
CrashReporter Key:   4757f4c5e5f009daf18eb0c512f729356c3e5de4
Hardware Model:      iPhone3,1
Process:         Get Off Now! [3751]
Path:            /var/mobile/Applications/43D41F77-B225-4F47-AFB0-D2F2E00E18DF/Get Off Now!.app/Get Off Now!
Identifier:      Get Off Now!
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2010-12-23 13:06:50.363 +0800
OS Version:      iPhone OS 4.1 (8B117)
Report Version:  104

Exception Type:  00000020
Exception Codes: 0x8badf00d
Highlighted Thread:  0

Application Specific Information:
Get Off Now![3751] has active assertions beyond permitted time: 
{(
    <SBProcessAssertion: 0xca2a8a0> identifier: CoreLocationRegistration process: Get Off Now![3751] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:3751 preventSuspend  preventIdleSleep 
)}

Elapsed total CPU time (seconds): 600.010 (user 19.350, system 580.660), 100% CPU 
Elapsed application CPU time (seconds): 575.320, 96% CPU

Thread 0:
0   libSystem.B.dylib               0x00004f0c OSSpinLockLock + 44
1   CoreFoundation                  0x0005aa42 CFMessagePortInvalidate + 26
2   CoreFoundation                  0x0005b05e CFMessagePortIsValid + 42
3   CoreLocation                    0x000030f8 CLClientIsValid + 12
4   CoreLocation                    0x00004b10 CLClientSendAndCache(__CLClient*, CLDaemonCommType, void*, int, unsigned char, unsigned char) + 40
5   CoreLocation                    0x000051cc CLClientHandleWatchdogTimerExpiry(__CFRunLoopTimer*, void*) + 24
6   CoreFoundation                  0x000567f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
7   CoreFoundation                  0x000562a6 __CFRunLoopDoTimer + 854
8   CoreFoundation                  0x0002779e __CFRunLoopRun + 1082
9   CoreFoundation                  0x00027270 CFRunLoopRunSpecific + 224
10  CoreFoundation                  0x00027178 CFRunLoopRunInMode + 52
11  GraphicsServices                0x000045ec GSEventRunModal + 108
12  GraphicsServices                0x00004698 GSEventRun + 56
13  UIKit                           0x0000411c -[UIApplication _run] + 396
14  UIKit                           0x00002128 UIApplicationMain + 664
15  Get Off Now!                    0x000022de main (main.m:13)
16  Get Off Now!                    0x000022a8 start + 32

Thread 1:
0   libSystem.B.dylib               0x0002d330 kevent + 24
1   libSystem.B.dylib               0x000d6b6c _dispatch_mgr_invoke + 88
2   libSystem.B.dylib               0x000d65bc _dispatch_queue_invoke + 96
3   libSystem.B.dylib               0x000d675c _dispatch_worker_thread2 + 120
4   libSystem.B.dylib               0x0007a67a _pthread_wqthread + 258
5   libSystem.B.dylib               0x00073190 start_wqthread + 0

Thread 2:
0   libSystem.B.dylib               0x00000c98 mach_msg_trap + 20
1   libSystem.B.dylib               0x00002d64 mach_msg + 44
2   CoreFoundation                  0x00027c38 __CFRunLoopServiceMachPort + 88
3   CoreFoundation                  0x000274c2 __CFRunLoopRun + 350
4   CoreFoundation                  0x00027270 CFRunLoopRunSpecific + 224
5   CoreFoundation                  0x00027178 CFRunLoopRunInMode + 52
6   WebCore                         0x000024e2 RunWebThread(void*) + 362
7   libSystem.B.dylib               0x0007a27e _pthread_start + 242
8   libSystem.B.dylib               0x0006f2a8 thread_start + 0

Unknown thread crashed with unknown flavor: 5, state_count: 1


I think you need to check some objects which are released by other threads, but they are accessed by main thread. I encountered something like this, and it was because I accessed some objects which had been released.


I had precisely the same crash logs being generated. I have a main thread, which uses an NSOperationQueue to spawn a data download thread, which then uses performSelectorOnMainThread when finished.

In my didupdatelocation method, I was cycling through an array, launching a local notification in some cases. It seemed to fail on the SECOND instance of a local notification (for the same array item), but I cannot be sure. I did try symbolicating the logs, but there is some missing file error with 4.2.1, so I'd copied in symbols from 4.2, and couldn't get atos to work (but that was probably my fault).

Last night I made the following changes, and all seems to be resolved:

1) changed all self.locationManager notation to just locationManager

2) removed everything from the dealloc method in the appdelegate (aside from super)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜