Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CoreBluetooth[ERROR] XPC connection interrupted, resetting

When I am trying to connect with Bluetooth LE with my iphone application. It gives CoreBluetooth[ERROR] XPC connection interrupted, resetting. Why is it.?

like image 388
Kamala Tennakoon Avatar asked Mar 01 '13 02:03

Kamala Tennakoon


2 Answers

“CoreBluetooth[ERROR] XPC connection interrupted, resetting” means that the blued Bluetooth daemon has crashed. You may be able to see more details by opening Console and looking at the system log and DiagnosticReports.

In my case, it seems that the exception within blued happens because SerialNumber is nil somewhere. I have no workaround and have reported it to bugreport.apple.com (bug 16075785).

The method that actually causes the exception is deterministic but varies by computer. On one computer with internal Bluetooth 4.0 chip, it is the call to -[CBPeripheral discoverCharacteristics:forService:]. On another computer with Bluetooth 4.0 USB adapter, it is the call to -[CBPeripheral writeValue:forCharacteristic:type:] or -[CBPeripheral setNotifyValue:forCharacteristic:]

'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: SerialNumber)'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x00007fff91b1141c __exceptionPreprocess + 172
        1   libobjc.A.dylib                     0x00007fff9231de75 objc_exception_throw + 43
        2   CoreFoundation                      0x00007fff91a0c62e -[__NSDictionaryM setObject:forKey:] + 1102
        3   blued                               0x0000000103d5d422 blued + 336930
        4   blued                               0x0000000103d4b115 blued + 262421
        5   IOBluetooth                         0x00007fff97354093 -[IOBluetoothL2CAPChannel processIncomingData:] + 576
        6   IOBluetooth                         0x00007fff97353e3c -[IOBluetoothL2CAPChannel handleMachMessage:] + 45
        7   Foundation                          0x00007fff94d98e35 __NSFireMachPort + 94
        8   CoreFoundation                      0x00007fff91a42d04 __CFMachPortPerform + 388
        9   CoreFoundation                      0x00007fff91a42b69 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41

Edit 2014-02-27: My particular crash happens because the device GATT table contains an invalid non-UTF8 value for Characteristic 2A25 «Serial Number String» within Service 180A «Device Information», and the blued daemon is creating a NSString* from it and putting it into a NSMutableDictionary. A temporary workaround is to make setObject:forKey: never fail within blued by jumping to the nearest ret command:

sudo /Applications/Xcode.app/Contents/Developer/usr/bin/lldb <<PID of blued>>
breakpoint set --fullname "-[__NSDictionaryM setObject:forKey:]" --condition "$rdx == 0"
breakpoint command add 1
register write pc `$pc+967`
continue
DONE
like image 51
yonran Avatar answered Oct 26 '22 14:10

yonran


Happens to me too - specifically when initiating a CBCentralManager (CM) scan when I stop the CM scan and restart it - it is usually resolved. I am afraid it's a bug in CoreBluetooth implementation

like image 34
mindbomb Avatar answered Oct 26 '22 13:10

mindbomb