Apple Instruments stops working when tracing iOS allocations - ios

I'm checking an Xamarin iOS app's memory usage using Instruments' Allocations instrument.
I have an issue with Instruments stopping to receive any allocations data just after a short while. I haven't seen any patterns in memory usage, cpu usage, time, or location in the app when the problem is triggered, but most of the times it stops working after about 12 seconds.
It seems like the following is logged in the device log the same moment it stops working:
kernel[0] <Notice>: Sandbox: SalesApp(2291) deny(1) process-info-pidinfo 1530
kernel[0] <Notice>: Sandbox: SalesApp(2291) deny(1) sysctl-read kern.proc.pid.1530
What could be the problem?
Every time it stops I can stop the recording ant restart it an it runs for a while again.
I have tried restarting everything with no change in behaviour. I know I had this problem last December, but then on a different version of Xcode, iOS, OS X, Xamarin Studio and I had a different iPad.
Current versions:
iOS: 9 beta 5 (13A4325c)
OS X: Yosemite (10.10.5 (14F27))
Xcode/Instruments: 6.4 (6E35b)
Xamarin Studio: 5.9.5 (build 10)
Deployment target: 7.0
Screenshot from Instruments where the recording stopped right after 7 seconds:

This is a known issue where an unfortunate interaction between the GC and Instruments causes the process to deadlock.
There are a few (wide) shots you can take to try and make it work:
Trigger the GC frequently on the main thread by doing this in your FinishedLaunching method:
NSTimer.CreateRepeatingScheduledTimer(0.5, (v) => GC.Collect());
Try to allocate less memory so that the GC triggers less frequently (I know this is what you're trying to do in the first place)
Try to do stuff on the main thread only. The deadlock occurs when an Instruments reports an allocation on one thread, while the GC is running on another. If you're only doing work on one thread, the deadlock doesn't occur.
It's usually random, so sometimes you might get lucky and it doesn't deadlock. IOW just try again and again.

Related

Parse iOS framework causing memory crashes

I've used Xcode's zombie debugger and managed to find this flag upon launch:
This crashed the app, and re-recording from Instruments caused the same result. Relaunching the app from the device made the app launch without a crash and subsequent launches from Instruments resulted in normal operation without flags or crashes.
Can anyone make sense of this or advise? I'm getting a number of "heap corruption" crashes in production. The reports are limited to a handful of users, but I'm afraid that number is growing.
It looks like the Parse SDK's latest release notes (1.15.1) addresses this:
-Adds polygonal queries
-Fixes memory leaks related with PFCommandCache
But my crash reports are coming from builds with this SDK version.
The Parse team has responded saying that a fix for this is coming to a new SDK release soon. :)

debugserver died with an exit status of 0x00000000

I was running an app on Xcode with the iPhone 6 stimulator using the latest iOS 10. And after some time the app crashed with the following message:
debugserver died with an exit status of 0x00000000
Here is the screenshot of that crash message:
I ran the code at 7:56 PM and it crashed 9 minutes later. So does anyone have any idea why this is happening? Is this an indication that the app might crash when it goes to the background or anything else?
To give you further insides of it why it happens there are several reasons:
The debugserver crashed or was terminated by another process
More likely the debugserver had a memory or CPU usage peak which invoked termination.
To fix this, update your version and see for updates or wait for next patches, releases from apple.
Also check for specific processes that use up a lot memory or CPU usage below (e.g. Chrome / Firefox) terminate them and observe it happen more frequent or not at all anymore.
I think that's all what you can do on YOUR side. I hope that brings a bit more clarity where the problem lies.

App crashes but no crashlogs on the device

Our current beta version of the app crashes sometimes, this happens to myself and my colleagues. The beta's are send with Apple's TestFlight app and I build it to my own phone. Phones are iPhone6 running latest iOS8.
When I hook each of them on my mac and load the crashlogs I couldn't find any crashlogs on the time the crash has occurred (also none on other times). I see recent crashlogs of other apps but none of the crashes is our app. Also there isn't an unknown crash at that time indicating a memory issue.
The app crashes after using it a couple of minutes to a hour and seems not to crash each time. So not on startup but somewhere in the middle and not always in the middle. App is using the users-location actively.
Changes in this beta version:
- More MKOverlays on the map
- First time MKMapCamera to position the users location on the map
- Crashes occur while using the map
Any ideas?
Best,
Sjoerd
edit:
After running the app on my phone in xcode for some time I finally found some crashlogs. Perhaps it's the kind of crash?:
Exception Type: EXC_RESOURCE
Exception Subtype: WAKEUPS
Exception Message: (Limit 150/sec) Observed 300/sec over 300 secs
Triggered by Thread: 19
Seems that I had memory crashes at another time. Weird.
I ran the app on my own phone (not simulator) in debug and found out that is was a memory crash. Now the memory crashlog was there with the right time now
Not sure what happened before and why the time wasn't right.
Also memory crashlogs appear as unknown. See the first one:

App crashes on some device with Application exited abnormally with signal 11: Segmentation fault: 11

I'm working on an iOS app and it load images from an URL like this image it is working perfectly on all the test devices in my office(and on simulator as well). but client said that the app is crashing whenever any image comes, everything else working as expected.
Now the question is if there is any problem than how it is working on my side? Is there any way(any app or anything) by using them client can send crash report to me so i can check?
Note:- we are testing on the same iOS version(7.x)
EDIT:- Some how they get the log and send to me from that i got
May 20 22:48:47 iPhone-5S com.apple.launchd[1] (UIKitApplication:com.Ba-cha[0xfbd1][287]) <Warning>: (UIKitApplication:com.Ba-cha[0xfbd1]) Job appears to have crashed: Segmentation fault: 11
May 20 22:48:47 iPhone-5S backboardd[31] <Warning>: Application 'UIKitApplication:com.Ba-cha[0xfbd1]' exited abnormally with signal 11: Segmentation fault: 11
I searched for the same and tried NSZombieEnabled but in my device (iPhone 4 and iPhone5) it is working perfectly no log? And now the question is How can i reproduce the issue on my device?
This is hit and try solution(at least worked for me):- My app Was worked fine on iPhone4 and 5(32 bit) but crash on iPhone 5s i.e. 64 bit processor. From some research on stackoverflow and Apple official i come to know perhaps there may be some problem in conversion between NSInteger to int. so i use NSInteger every where instead int.
Also i'v to remove armv64 from my project and set NO for "Build Active Architecture Only" (debug and release)
That did the trick for me, I didn't really need any 64bit specific functionality on my app so I took it out. I know this is a hack and not a good solution but at least it works.
As Adam suggested, iTunes would work but it may be better to save your client the chore...
You could alternatively send them a new version of the app using something like HockeyApp or TestFlight (free) integrated, allowing you to automatically receive the crash logs as well as the wide range of other useful tools they provide such as easier installation by the client.
They can load Xcode, and connect the device. Device logs can be viewed in the Organizer window. Crashes are marked as such. The log text can be cut and pasted or the export button can just save the whole thing as text.
Crashlytics offers software and service to upload crash logs.
It is possible to build up the information that appears in a crash log, but you will need unix signal handlers, various exceptions handlers, and a server to upload to.
Segmentation fault 11 means memory allocation issue. You possibly have made a coding issue like: using weak/assign, instead strong on NSObject

iOS app runs in simulator, ad-hoc distribution crash on launch

My iOS app runs correctly in the simulator and debugging device but when running on an ad-hoc allocated device, the app crashes and according to the app called "console" the app crashes with signal 9, killed 9 and also the app is killed with for termination assertion. I'm lost at this point as what to do. Let me know if you need more information.
Here's the link to the code: https://www.dropbox.com/s/ch48v8uiyx7wiqh/Animal.zip
Besides the other answers, which are good suggestions, a common root cause of this problem is that the Debug configuration can sometimes mask dangling pointer memory bugs. Do the following:
Run the app in the simulator with release configuration. If it crashes. . .
Use log statements and reruns to narrow in on the cause (debugger won't be available).

Resources