Hello, we are frequently getting a crash in our app when it’s running in the background playing audio.
The crash is a EXC_BAD_ACCESS KERN_INVALID_ADDRESS in _pthread_testcancel, it’s always in this place on all occasions.
From Crashlytics we can see that the user’s phone at the time has low free RAM memory (2%-3%), but not from us, we are using only around 40-60MB of RAM when it crashes.
Maybe the OS is trying to free up some resources of the app and it causes a crash.
We are using the latest MOE 1.2 version.
The crashes all happened on iOS 10.0.2, 10.1.1, 10.0.1, on iPhone 5s, and iPhone 6.
we will need the full crashlogs to look at this. The more crash logs, the better (so we can see if there is a variation in them.). Can you confirm, that you are using MOE 1.2.5? 1.2.5 added a fix in the arm64 code generator.
From the attached crash log it looks like the “server time timer” thread is crashed. Is this a thread that you created? What does it do? More specifically: what does it do while your app is in the background? Would it be possible to stop it when your app goes into the background?
About the crash: we symbolicated the crash log, and checked the source of pthread. From the source it looks like pthread_testcancel() tries to aquire an internal pthread lock, from pthread_self(). However, pthread_self() returned NULL for some weird reason. pthread_self() actually returns the contents of a thread local storage slot and it shouldn’t be null in any thread created by pthread.
We don’t know yet, how this could even happen. How frequently does this happen?
Were you able to reproduce this issue locally, or it only happened in the wild?
This thread is responsible for synchronizing the current time from an NTP server, which we need to be relatively accurate for our needs. It’s activity is very small, and the code is slso very small.
It is not this specific thread that crashes every time, sometimes it’s different threads.
We have several crashes with this error in Crashlytics.
I’m not sure how to send it to you.
According to crashlytics the device had only 2-3% ava
2-3% available RAM left at the time of the crash.
And in every case it’s the same stack trace in the thread that crashes.
So my guess is that something gets realeased in pthread but still being used later…