touchlab / xcode-kotlin

Kotlin Native Xcode Plugin
https://touchlab.co/xcodekotlin
Apache License 2.0
1.17k stars 46 forks source link

Xcode crashes on launch with xcode-kotlin installed after updating to macOS 13.5 #97

Closed toddthomas closed 12 months ago

toddthomas commented 1 year ago

Summary

With xcode-kotlin installed via Homebrew, Xcode 14.3.1 was crashing on every launch attempt after I updated to macOS 13.5.

Details

Here's the relevant portion of a crash log that led me to suspect an Xcode plugin.

Process:               Xcode [6765]
Path:                  /Applications/Xcode-14.3.1.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               14.3.1 (21815)
Build Info:            IDEFrameworks-21815000000000000~2 (14E300c)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               502

Date/Time:             2023-07-24 20:21:03.4225 -0600
OS Version:            macOS 13.5 (22G74)
Report Version:        12
Anonymous UUID:        98E02397-17E1-FC60-7879-5861D2741E7C

Time Awake Since Boot: 870 seconds

System Integrity Protection: enabled

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

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Termination Reason:    Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process:   Xcode [6765]

Application Specific Information:
abort() called

Application Specific Signatures:
_mutableDirectExtensions != ((void *)0)

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib                 0x18aafc764 __pthread_kill + 8
1   libsystem_pthread.dylib                0x18ab33c28 pthread_kill + 288
2   libsystem_c.dylib                      0x18aa41ae8 abort + 180
3   IDEKit                                 0x107433220 +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 980
4   IDEKit                                 0x107433660 -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] + 872
5   DVTFoundation                          0x103dd5c40 _DVTAssertionHandler + 424
6   DVTFoundation                          0x103dd5dc0 _DVTAssertionFailureHandler + 196
7   DVTFoundation                          0x103e1c3d0 -[DVTExtensionPoint _registerExtension:] + 296
8   DVTFoundation                          0x103c4b55c -[DVTExtension awakeFromPropertyList] + 176
9   DVTFoundation                          0x103c84e50 -[DVTPlugIn awakeFromPropertyList] + 384
10  DVTFoundation                          0x103db44e4 -[DVTPlugInManager _createPlugInObjectsFromScanRecords:] + 328
11  DVTFoundation                          0x103db2a78 __52-[DVTPlugInManager _recordNonApplePlugInDescriptor:]_block_invoke + 92
12  DVTFoundation                          0x103db3040 -[DVTPlugInManager _allowNonApplePlugInsFromDescriptors:error:] + 304
13  DVTFoundation                          0x103db3228 -[DVTPlugInManager _checkNonApplePlugIns] + 204
14  DVTFoundation                          0x103db3304 -[DVTPlugInManager initializePlugIns:] + 20
15  IDEFoundation                          0x108ad2e74 _IDEInitializeOtherPlugInStuff + 168
16  IDEFoundation                          0x108ad51b0 IDEInitialize + 4968
17  IDEKit                                 0x107417dcc -[IDEApplicationController applicationWillFinishLaunching:] + 484
18  CoreFoundation                         0x18ac07180 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
19  CoreFoundation                         0x18aca2eec ___CFXRegistrationPost_block_invoke + 88
20  CoreFoundation                         0x18aca2e34 _CFXRegistrationPost + 440
21  CoreFoundation                         0x18abd84cc _CFXNotificationPost + 704
22  Foundation                             0x18bb368e4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
23  AppKit                                 0x18de2b1bc -[NSApplication finishLaunching] + 248
24  DVTKit                                 0x102d82f94 -[DVTApplication finishLaunching] + 196
25  AppKit                                 0x18de2aea8 -[NSApplication run] + 252
26  DVTKit                                 0x102d82e08 -[DVTApplication run] + 60
27  AppKit                                 0x18de023cc NSApplicationMain + 880
28  dyld                                   0x18a7dbf28 start + 2236

Reproduction

I haven't performed these steps as such, I'm proposing how you would set up the situation I found myself in.

  1. Install Xcode 14.3.1 on macOS 13.4.1.
  2. brew install xcode-kotlin
  3. Xcode should launch successfully.
  4. Update to macOS 13.5.
  5. Attempt to launch Xcode.

Expected result

Xcode launches successfully.

Current state

Xcode crashes immediately, before any of its windows are shown. Holding down Option-Shift while launching does not fix the problem, so it's not due to opening the projects that were open when you last ran Xcode.

Possible Fix

The problem was fixed for me by brew uninstall xcode-kotlin.

Screenshots

None.

Issue Labels

toddthomas commented 1 year ago

Update: I reinstalled via

brew install xcode-kotlin

and Xcode 14.3.1 launched successfully.

I then did

xcode-kotlin uninstall
xcode-kotlin install

and Xcode is still launching fine. So for me the crashing issue only occurred after updating to macOS 13.5, and reinstalling xcode-kotlin seems to allow it to work again. Though I haven't yet tested using xcode-kotlin features in Xcode.

TadeasKriz commented 1 year ago

I couldn't reproduce this, but we have a worse problem that might be related (#95) and it's unfortunately a bug in Xcode itself (it seems).

TadeasKriz commented 12 months ago

Just released Xcode Kotlin CLI 1.3.0 which includes an automated workaround for the crash.