CoreBluetooth and Mojave

Issue #266 new
Kamesh Velu created an issue

After I updated my Mac to Mojave my python CoreBluetooth scripts crash the bluetooth When I check the crash report I see invalid address access. The Same script work on Mac 10.13.4

Is this related to Sanboxing in Mojave? If so is there a workaround to resolve this

From Crash report

****
Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [7217]

VM Regions Near 0:
--> 
    __TEXT                 000000010fa4b000-000000010fce1000 [ 2648K] r-x/rwx SM=COW  /usr/sbin/bluetoothd

Application Specific Information:
dyld3 mode

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libxpc.dylib                    0x00007fff607cc16b xpc_get_type + 6
1   libxpc.dylib                    0x00007fff607d558d xpc_array_get_count + 14
2   bluetoothd                      0x000000010fc5787b 0x10fa4b000 + 2148475
3   bluetoothd                      0x000000010fbd287a 0x10fa4b000 + 1603706
4   libxpc.dylib                    0x00007fff607d6a28 _xpc_connection_call_event_handler + 56
5   libxpc.dylib                    0x00007fff607d49be _xpc_connection_mach_event + 933
6   libdispatch.dylib               0x00007fff60554e6f _dispatch_client_callout4 + 9
7   libdispatch.dylib               0x00007fff60569b0f _dispatch_mach_msg_invoke + 449
8   libdispatch.dylib               0x00007fff6055afc9 _dispatch_lane_serial_drain + 271
9   libdispatch.dylib               0x00007fff6056a639 _dispatch_mach_invoke + 485
10  libdispatch.dylib               0x00007fff6055fe25 _dispatch_main_queue_callback_4CF + 807
11  com.apple.CoreFoundation        0x00007fff333560c7 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
12  com.apple.CoreFoundation        0x00007fff333557d6 __CFRunLoopRun + 2335
13  com.apple.CoreFoundation        0x00007fff33354c64 CFRunLoopRunSpecific + 463
14  com.apple.Foundation            0x00007fff356bb4aa -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 280
15  com.apple.Foundation            0x00007fff356bb37f -[NSRunLoop(NSRunLoop) run] + 76
16  bluetoothd                      0x000000010fb278fe 0x10fa4b000 + 903422
17  libdyld.dylib                   0x00007fff605a2ed9 start + 1

Thread 1:
0   libsystem_pthread.dylib         0x00007fff607953f8 start_wqthread + 0
1   ???                             0x0000000054485244 0 + 1414025796

Thread 2:: com.apple.CFSocket.private
0   libsystem_kernel.dylib          0x00007fff606e35aa __select + 10
1   com.apple.CoreFoundation        0x00007fff33383c13 __CFSocketManager + 639
2   libsystem_pthread.dylib         0x00007fff60796305 _pthread_body + 126
3   libsystem_pthread.dylib         0x00007fff6079926f _pthread_start + 70
4   libsystem_pthread.dylib         0x00007fff60795415 thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00007fff8bec84a8  rbx: 0x0000000000000000  rcx: 0x0000000000000006  rdx: 0xcd7ead9c3b2a403a
  rdi: 0x0000000000000000  rsi: 0x00007fff607f1380  rbp: 0x00007ffee01b32a0  rsp: 0x00007ffee01b3288
   r8: 0x0000000000000058   r9: 0x0000000000000000  r10: 0x00007fff933a48e8  r11: 0x00007ffd1bf17ab0
  r12: 0x0000000000000000  r13: 0x0000000000000002  r14: 0x00007ffd1db03180  r15: 0x00007ffd1bf1c2d0
  rip: 0x00007fff607cc16b  rfl: 0x0000000000010246  cr2: 0x0000000000000000

Logical CPU:     7
Error Code:      0x00000004
Trap Number:     14

Comments (2)

  1. Ronald Oussoren repo owner

    The report does not contain enough information to determine what's going on here, or even to reproduce.

    The crash report is of the bluetooth daemon, not of the process using PyObjC to call CoreBluetooth.

    There are two fairly obvious things that might cause this crash:

    1. You run into a bug of the bluetooth stack that's new in Mojave

    2. You're calling the CoreBluetooth API incorrectly and that crashes the bluetooth stack (although I'd consider that a special case of item 1)

  2. Log in to comment