Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crash in iOS: XPC API Misuse

Tags:

ios

iphone

xpc

We have a crash in our iOS app reported by crashlytics:

Crashed: XPC API Misuse: Attempt to send a message expecting a reply to (com.apple.networking.connection.0x46bf35a0)

The stack trace is:

Thread : Crashed: XPC API Misuse: Attempt to send a message expecting a reply to  (com.apple.networking.connection.0x46bf35a0)
0  libxpc.dylib                   0x35cc534a _xpc_api_misuse + 41
1  libsystem_c.dylib              0x35ba49e5 __strlcpy_chk + 48
2  libxpc.dylib                   0x35cb5f75 _xpc_serializer_create + 158
3  libxpc.dylib                   0x35cb5ea1 xpc_connection_send_message + 60

It happened under iOS 9.0.2 on a iPhone 5. We are not able to reproduce the crash and we have no idea how to start debugging/fixing. It seems that we are not alone with this.

Maybe somebody here has any ideas.

like image 389
Chris Avatar asked Oct 20 '15 11:10

Chris


1 Answers

There are a lot of open bugs on this issue: rdar://21832853 is the original bug, along with rdar://22860899 and rdar://22874333, both of which are on OpenRadar.

I think that this is caused by some C-based networking code in SCNetworkReachability, and it is trying to talk to either the iOS VPN system—presumably to determine whether one is connected—or to the background daemon that is used for NSURLSession requests, but I'm not certain. Unfortunately, CFNetwork is not open source, and the libdispatch sources for 10.11 (as close to iOS 9 as you'll get) haven't been posted yet, so I can't even begin to guess what the networking code is doing wrong.

Either way, I don't think you're going to be able to work around it. With that said, assuming I'm right about the root cause, you might be able to reproduce it by running Network Link Conditioner and turning Airplane mode on and off repeatedly. Worth a try, anyway.

like image 51
dgatwood Avatar answered Oct 01 '22 17:10

dgatwood