My application is hitting 100% CPU and continuously consuming more RAM. I have used instruments and found the offending line of code, it seems its being called in some sort of an infinite loop. However the backtrace does not give me any indication of the caller only a library function that is calling it.
I have searched the entire codebase and have not located any user code calling the offending function.
I'm looking for a way to dig deeper and discover what may be causing _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion to be repeatedly called
Backtrace:
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
* frame #0: 0x0000000105bf6187 Demo App`-[UIImageView(self=0x00007fa291f85660, _cmd="setTintColor:", color=0x000060000004d020) setTintColor:] at UIImageView+Utils.m:21
frame #1: 0x000000010677d0bc UIKit`+[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 560
frame #2: 0x000000010677d599 UIKit`+[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 99
frame #3: 0x0000000106b24792 UIKit`-[UIButton _updateImageView] + 1005
frame #4: 0x0000000106b24fc4 UIKit`-[UIButton layoutSubviews] + 211
frame #5: 0x000000010678a4f1 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1439
frame #6: 0x000000010d29149a QuartzCore`-[CALayer layoutSublayers] + 153
frame #7: 0x000000010d295589 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 401
frame #8: 0x0000000106774531 UIKit`-[UIView(Hierarchy) layoutBelowIfNeeded] + 662
frame #9: 0x0000000107301063 UIKit`-[UIInputSetHostView layoutIfNeeded] + 104
frame #10: 0x0000000106f7a08e UIKit`-[_UIRemoteKeyboards ignoreLayoutNotifications:] + 27
frame #11: 0x0000000107311838 UIKit`__43-[UIInputWindowController setInputViewSet:]_block_invoke + 125
frame #12: 0x000000010677b6ec UIKit`+[UIView(Animation) performWithoutAnimation:] + 90
frame #13: 0x000000010731152f UIKit`-[UIInputWindowController setInputViewSet:] + 702
frame #14: 0x00000001073089d1 UIKit`-[UIInputWindowController performOperations:withAnimationStyle:] + 50
frame #15: 0x0000000106ea9f9e UIKit`-[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 1081
frame #16: 0x00000001068ecacd UIKit`-[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 81
frame #17: 0x00000001073d1cc7 UIKit`-[UITextField becomeFirstResponder] + 690
```
Related
My project was working absolutely fine, until the upgrade to 9.3. Right after the upgrade I started seeing the EXC_BAD_ACCESS error at my AppDelegate class.
I'm new to IOS development and this is my first Xcode update, are there any steps that I'm supposed to do to make sure my projects don't break like this on every update?
I'm using the Spotify API to mimic an instagram like feed and play songs from spotify on each post. Here is the bt
2018-04-04 22:32:08.479489-0400 Project2[43968:2765723] CreateMetadataFromXMPBufferInternal:566: Threw error #201 (XML parsingfailure)
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000109f772cf libswiftCore.dylib`swift_getObjectType +47
frame #1: 0x0000000104b38e58 Project2`#objcAppDelegate.application(_:open:sourceApplication:annotation:) at AppDelegate.swift:0
frame #2: 0x0000000107adc33f UIKit`__58-[UIApplication_applicationOpenURLAction:payload:origin:]_block_invoke + 1037
frame #3: 0x0000000107adbc31 UIKit`-[UIApplication _applicationOpenURLAction:payload:origin:] + 652
frame #4: 0x0000000107ae8eff UIKit`-[UIApplication_handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 4851
frame #5: 0x0000000107e9466d UIKit`-[__UICanvasLifecycleMonitor_CompatabilityactivateEventsOnly:withContext:completion:] + 1641
frame #6: 0x00000001088054d4 UIKit`__82-[_UIApplicationCanvas_transitionLifecycleStateWithTransitionContext:completion:] _block_invoke + 299
frame #7: 0x000000010880536e UIKit`-[_UIApplicationCanvas_transitionLifecycleStateWithTransitionContext:completion:] + 433
frame #8: 0x00000001084e962d UIKit`__125- [_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff: fromSettings:transitionContext:]_block_invoke + 221
frame #9: 0x00000001086e4387UIKit`_performActionsWithDelayForTransitionContext + 100
frame #10: 0x00000001084e94f7 UIKit`- [_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
frame #11: 0x0000000108265fb0 UIKit`-[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
frame #12: 0x00000001080a2f89 UIKit`-[UIApplicationSceneClientAgentscene:handleEvent:withCompletion:] + 502
frame #13: 0x000000011094ed2d FrontBoardServices`__80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362 + 198
frame #14: 0x000000010ac2c848 libdispatch.dylib`_dispatch_client_callout + 8
frame #15: 0x000000010ac31e14 libdispatch.dylib`_dispatch_block_invoke_direct + 592
frame #16: 0x0000000110982470 FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
frame #17: 0x000000011098212e FrontBoardServices`-[FBSSerialQueue _performNext] + 439
frame #18: 0x000000011098268e FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 45
frame #19: 0x0000000106944bb1 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
frame #20: 0x00000001069294af CoreFoundation`__CFRunLoopDoSources0 +271
frame #21: 0x0000000106928a6f CoreFoundation`__CFRunLoopRun + 1263
frame #22: 0x000000010692830b CoreFoundation`CFRunLoopRunSpecific + 635
frame #23: 0x000000010da7aa73 GraphicsServices`GSEventRunModal + 62
frame #24: 0x0000000107ad30b7 UIKit`UIApplicationMain + 159
* frame #25: 0x0000000104b393f7 Project2`main at AppDelegate.swift:12
frame #26: 0x000000010aca9955 libdyld.dylib`start + 1
(lldb)
Can someone help please? Has anyone seen anything of this sort?
I am using pdfTron with iOS. I have successfully integrated PDFTron with my iOS application.
Now I am facing an issue where in if an already made annotation is selected and I try to go back from the view, the application is crashing with EXC_BAD_ACCESS error. I am able to see the previous screen while going back. After the previous screen appears, then the app gets crashed in main. This does not happen when I come back without the annotation being selected.
* thread #1: tid = 0x14c78, 0x0281b3f6 myProject`___lldb_unnamed_symbol40638$$myProject + 22, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x800000a0)
frame #0: 0x0281b3f6 myProject`___lldb_unnamed_symbol40638$$myProject + 22
frame #1: 0x0250ce31 myProject`___lldb_unnamed_symbol28291$$myProject + 49
frame #2: 0x01bf03f8 myProject`TRN_AnnotIsValid + 40
frame #3: 0x01afd0ba myProject`ObjCPP_PTAnnot_IsValid + 34
frame #4: 0x01a80e0a myProject`-[PTAnnot IsValid] + 32
frame #5: 0x0199d062 myProject`-[AnnotEditTool deselectAnnotation] + 66
frame #6: 0x0198e96b myProject`-[AnnotEditTool willMoveToSuperview:] + 91
frame #7: 0x066e21ce UIKit`__UIViewWillBeRemovedFromSuperview + 305
frame #8: 0x066e1ee3 UIKit`-[UIView(Hierarchy) removeFromSuperview] + 99
frame #9: 0x019a0c09 myProject`-[ToolManager dealloc] + 73
frame #10: 0x06ef413d UIKit`-[UIView(UIKitManual) release] + 142
frame #11: 0x01a7acae myProject`-[PTPDFViewCtrl dealloc] + 588
frame #12: 0x06ef413d UIKit`-[UIView(UIKitManual) release] + 142
frame #13: 0x08e0ca57 CoreFoundation`CFRelease + 727
frame #14: 0x08e2285e CoreFoundation`-[__NSArrayM dealloc] + 142
frame #15: 0x08966060 libobjc.A.dylib`objc_object::sidetable_release(bool) + 238
frame #16: 0x08965361 libobjc.A.dylib`objc_release + 65
frame #17: 0x0896652d libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 371
frame #18: 0x08e2d508 CoreFoundation`_CFAutoreleasePoolPop + 24
frame #19: 0x08e65cdc CoreFoundation`__CFRunLoopRun + 2364
frame #20: 0x08e650e6 CoreFoundation`CFRunLoopRunSpecific + 470
frame #21: 0x08e64efb CoreFoundation`CFRunLoopRunInMode + 123
frame #22: 0x0a49a664 GraphicsServices`GSEventRunModal + 192
frame #23: 0x0a49a4a1 GraphicsServices`GSEventRun + 104
frame #24: 0x0662bbfa UIKit`UIApplicationMain + 160
* frame #25: 0x0013c23c myProject`main(argc=1, argv=0xbffaa928) + 140 at main.m:16
frame #26: 0x09e6ca21 libdyld.dylib`start + 1
The first thing that Annot::IsValid does is check if the pointer is null or not. So if IsValid is crashing, then this means the underlying PDFDoc object has been destroyed, or the underlying pointer is not valid somehow.
First thing to check is if the PDFDoc object is alive or not. If it is destroyed then no objects associated with it should be used.
Or, you deleted the Annotation object earlier somehow, or its underlying pointer got changed. Object references should not be kept around in case they do get moved/deleted. If you want to retain annotations for long term, please see this post.
Sometime after writing code to my project, I noticed the debugger would pause my application and put lldb in the console and couldn't let me continue. I used NSZombies and I got this message : "-[NSThread threadDictionary]: message sent to deallocated instance". I have looked around but couldn't find any help what is causing this. When I print the backtrace I get:
thread #17: tid = 0x7886f, 0x0000000180f7ab40 CoreFoundation`___forwarding___ + 700, stop reason = EXC_BREAKPOINT (code=1, subcode=0x180f7ab40)
frame #0: 0x0000000180f7ab40 CoreFoundation`___forwarding___ + 700
frame #1: 0x0000000180e78c5c CoreFoundation`_CF_forwarding_prep_0 + 92
frame #2: 0x00000001860536dc UIFoundation`+[NSStringDrawingTextStorageSettings threadSpecificStringDrawingTextStorageSettings:] + 64
frame #3: 0x000000018604900c UIFoundation`+[NSString(NSStringDrawing) typesetterBehavior] + 32
frame #4: 0x000000018604a6d4 UIFoundation`__NSStringDrawingEngine + 244
frame #5: 0x000000018604a4d0 UIFoundation`-[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:] + 176
frame #6: 0x00000001860eb564 UIKit`-[UILabel _drawTextInRect:baselineCalculationOnly:] + 3856
frame #7: 0x000000018615e8f0 UIKit`-[UILabel drawTextInRect:] + 544
frame #8: 0x000000018615e678 UIKit`-[UIView(CALayerDelegate) drawLayer:inContext:] + 368
frame #9: 0x0000000183a92230 QuartzCore`-[CALayer drawInContext:] + 260
frame #10: 0x0000000183a7c8b4 QuartzCore`CABackingStoreUpdate_ + 2432
frame #11: 0x0000000183b94360 QuartzCore`___ZN2CA5Layer8display_Ev_block_invoke + 52
frame #12: 0x0000000183a7ba90 QuartzCore`CA::Layer::display_() + 1368
frame #13: 0x0000000183a5d7b0 QuartzCore`CA::Layer::display_if_needed(CA::Transaction*) + 228
frame #14: 0x0000000183a5d49c QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 44
frame #15: 0x0000000183a5cac0 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 252
frame #16: 0x0000000183a5c820 QuartzCore`CA::Transaction::commit() + 500
frame #17: 0x0000000183a8bbd4 QuartzCore`CA::Transaction::release_thread(void*) + 236
frame #18: 0x0000000180bda1e0 libsystem_pthread.dylib`_pthread_tsd_cleanup + 584
frame #19: 0x0000000180bd9d58 libsystem_pthread.dylib`_pthread_exit + 136
frame #20: 0x0000000180bd953c libsystem_pthread.dylib`_pthread_wqthread + 1296
frame #21: 0x0000000180bd9020 libsystem_pthread.dylib`start_wqthread + 4
Any help to find out whats going on will help tremendously!
Found out the problem was I had a label with a weak reference. I was hiding it for to long and it seems the garbage collection cleaned in up. So when I tried to send data to it, it was already dealloc.
Somewhere you are calling an instance method of any class and class object is nil.
I am running into a strange crash I'm having issues debugging. My scheme has both zombies and address sanatizer enabled.
I'm getting the error:
2015-09-05 06:56:16.240 asgaard[486:110984] *** -[CFString
boundingRectWithSize:options:attributes:context:]: message sent to
deallocated instance 0x1897b210
which is pretty unhelpful to me as its breaking on some assembly code.
I tried the memory history command which I'm not sure is what i need and got the following output:
thread #4294967295: tid = 0x0000, 0x00b39fb0 libclang_rt.asan_ios_dynamic.dylib`__asan_mz_malloc + 116, name = 'Memory allocated at'
frame #0: 0x00b39fb0 libclang_rt.asan_ios_dynamic.dylib`__asan_mz_malloc + 116
frame #1: 0x33587da6 libsystem_malloc.dylib`malloc_zone_malloc + 86
frame #2: 0x2471f982 CoreFoundation`_CFRuntimeCreateInstance + 290
frame #3: 0x247f3162 CoreFoundation`__CFStringCreateImmutableFunnel3 + 1718
frame #4: 0x2473962c CoreFoundation`CFStringCreateCopy + 396
frame #5: 0x247f33d6 CoreFoundation`_CFStringCreateWithFormatAndArgumentsAux2 + 86
frame #6: 0x25496a70 Foundation`-[NSPlaceholderString initWithFormat:locale:arguments:] + 136
frame #7: 0x25496972 Foundation`+[NSString stringWithFormat:] + 58
frame #8: 0x001ef70c asgaard`-[ActiveRecordingViewController updateSpeeds](self=<unavailable>, _cmd=<unavailable>) + 836 at ActiveRecordingViewController.m:578
frame #9: 0x001edd20 asgaard`__51-[ActiveRecordingViewController ahrswNotification:]_block_invoke(.block_descriptor=<unavailable>) + 192 at ActiveRecordingViewController.m:456
frame #10: 0x00b38ef0 libclang_rt.asan_ios_dynamic.dylib`__wrap_dispatch_async_block_invoke + 160
frame #11: 0x03273170 libdispatch.dylib`_dispatch_call_block_and_release + 8
frame #12: 0x0327315c libdispatch.dylib`_dispatch_client_callout + 20
frame #13: 0x03276e42 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1510
frame #14: 0x247e63e6 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 6
frame #15: 0x247e4ae6 CoreFoundation`__CFRunLoopRun + 1510
frame #16: 0x24730f2e CoreFoundation`CFRunLoopRunSpecific + 474
frame #17: 0x24730d40 CoreFoundation`CFRunLoopRunInMode + 104
frame #18: 0x2c0f91fe GraphicsServices`GSEventRunModal + 134
frame #19: 0x27f02876 UIKit`UIApplicationMain + 1438
frame #20: 0x00129b0a asgaard`main(argc=<unavailable>, argv=<unavailable>) + 106 at main.m:13
frame #21: 0x33499aac libdyld.dylib`tlv_initializer + 4
I'm a little lost here exactly what this message is telling me.
frame #8: 0x001ef70c asgaard`-[ActiveRecordingViewController updateSpeeds](self=<unavailable>, _cmd=<unavailable>) + 836 at ActiveRecordingViewController.m:578
Frame 8 is a function I wrote - and it is running in an async loop on the main thread - could that somehow be connected to this error?
The actual code line is:
578: [self coreGroundSpeed].text = [NSString stringWithFormat:#"%d Kts", coreSpd];
Any suggestions where/what to look at?
I tried to create a UICollectionView using the Flow Layout.
The cells are simply text labels for the time being.
The first screen of cells is displayed just fine, but when I try to scroll, the simulator crashes.
The debugger shows the following messages:
(lldb) thread backtrace
* thread #1: tid = 0x39235a, 0x008440b2 libobjc.A.dylib`objc_msgSend + 14, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xa000000c)
* frame #0: 0x008440b2 libobjc.A.dylib`objc_msgSend + 14
frame #1: 0x01ab9b30 UIKit`-[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 257
frame #2: 0x01abb775 UIKit`-[UICollectionView _updateVisibleCellsNow:] + 4730
frame #3: 0x01abf65f UIKit`-[UICollectionView layoutSubviews] + 265
frame #4: 0x014e2964 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
frame #5: 0x0084682b libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #6: 0x0280e45a QuartzCore`-[CALayer layoutSublayers] + 148
frame #7: 0x02802244 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
frame #8: 0x028020b0 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #9: 0x027687fa QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 294
frame #10: 0x02769b85 QuartzCore`CA::Transaction::commit() + 393
frame #11: 0x0276a258 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
frame #12: 0x02bd936e CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
frame #13: 0x02bd92bf CoreFoundation`__CFRunLoopDoObservers + 399
frame #14: 0x02bb7254 CoreFoundation`__CFRunLoopRun + 1076
frame #15: 0x02bb69d3 CoreFoundation`CFRunLoopRunSpecific + 467
frame #16: 0x02bb67eb CoreFoundation`CFRunLoopRunInMode + 123
frame #17: 0x05f5b5ee GraphicsServices`GSEventRunModal + 192
frame #18: 0x05f5b42b GraphicsServices`GSEventRun + 104
frame #19: 0x01473f9b UIKit`UIApplicationMain + 1225
frame #20: 0x0002423c 8actions`main(argc=1, argv=0xbfffe610) + 156 at main.mm:15
I am using the latest version of rubymotion and the IOS Simulator set to iPhone 4 Inch with IOS 7.1.
The code I am using can be found here:
https://gist.github.com/jhmegorei/42c15038a34971ac5e8e
Note: I did not want to use a CollectionViewController, as I require the collection View to be just another view element that can be added to a normal UIView.
I would be glad if there is anyone who could help me investigate the root cause of this crash :)
There is no "MemoListViewDelegate.rb" in the gist. Did you mean "MemoListDataSource.rb" ?
Also, I assume you mean you changed
list_view.dataSource = MemoListDatasource.new
to
list_view.dataSource = self
as well as moving the data source methods in there.
Did you make any other changes to get it to work?