SwiftLint: Xcode 10b2: (intermittent) Never call this for file that sourcekitd fails.: file File+Cache.swift, line 127 Abort trap: 6

Bug Report

I am having an intermittent failure of swiftlint when using Xcode 10 beta 2.

Version: 0.26.0 Installation: package as well as from the source

This occurs as part of a Run Script Phase as part of the Xcode build but I can reproduce it from the command line after setting $TOOLCHAIN_DIR. It occurs with --no-cache option as well. When it does occur, it happens before linting begins on any of the files and seems to come from the extension to SwiftVersion (see below). I just thought I’d pass this along to powers that be. I could not find as a similar report and it may be because of the beta of SourceKit. It there is something I can do to avoid this, please let me know.

$ swiftlint version
0.26.0
$ export TOOLCHAIN_DIR=/Applications/Xcode_10_Beta_2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
$ swiftlint
sourcekit: [1:connection-event-handler:3843: 0.0000] Connection interruptsourcekit: [1:updateSemanticEditorDelay:3843: 0.0004] disabling semantic editor for 10 secondssourcekit: [1:pingService:3843: 0.0005] pinging servicesourcekitten: connection to SourceKitService restored!
Connection interrupted
Never call this for file that sourcekitd fails.: file File+Cache.swift, line 127
Abort trap: 6

I examined the source of swiftlint and found that the place in File+Cache that issues the fatal error. I then modified swiftlint to display the path or contents of the file with the fatal error message and …

$ swiftlint
sourcekit: [1:connection-event-handler:6915: 0.0001] Connection interruptsourcekit: [1:updateSemanticEditorDelay:6915: 0.0012] disabling semantic editor for 10 secondssourcekit: [1:pingService:6915: 0.0013] pinging servicesourcekitten: connection to SourceKitService restored!
Connection interrupted
Never call this for file that sourcekitd fails. contents: #if swift(>=4.2.0)
    let version = "4.2.0"
#elseif swift(>=4.1.2)
    let version = "4.1.2"
#elseif swift(>=4.1.1)
    let version = "4.1.1"
#elseif swift(>=4.1.0)
    let version = "4.1.0"
#elseif swift(>=4.0.3)
    let version = "4.0.3"
#elseif swift(>=4.0.2)
    let version = "4.0.2"
#elseif swift(>=4.0.1)
    let version = "4.0.1"
#elseif swift(>=4.0.0)
    let version = "4.0.0"
#elseif swift(>=3.4.0)
    let version = "3.4.0"
#elseif swift(>=3.3.2)
    let version = "3.3.2"
#elseif swift(>=3.3.1)
    let version = "3.3.1"
#elseif swift(>=3.3.0)
    let version = "3.3.0"
#elseif swift(>=3.2.3)
    let version = "3.2.3"
#elseif swift(>=3.2.2)
    let version = "3.2.2"
#elseif swift(>=3.2.1)
    let version = "3.2.1"
#elseif swift(>=3.2.0)
    let version = "3.2.0"
#elseif swift(>=3.1.1)
    let version = "3.1.1"
#elseif swift(>=3.1.0)
    let version = "3.1.0"
#elseif swift(>=3.0.2)
    let version = "3.0.2"
#elseif swift(>=3.0.1)
    let version = "3.0.1"
#elseif swift(>=3.0.0)
    let version = "3.0.0"
#endif: file File+Cache.swift, line 131
Abort trap: 6

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 17 (2 by maintainers)

Most upvoted comments

@marcelofabri I’m using SwiftLint built off of master and I’m still getting this on our Jenkins server. If it helps here’s the output:

[13:44:03]: ▸ sourcekit: [1:connection-event-handler:5379: 0.0000] Connection interruptsourcekit: [1:updateSemanticEditorDelay:5379: 0.0005] disabling semantic editor for 10 secondssourcekit: [1:pingService:5379: 0.0006] pinging servicesourcekitten: connection to SourceKitService restored!
[13:44:03]: ▸ Connection interrupted
[13:44:03]: ▸ Never call this for file that sourcekitd fails.: file File+Cache.swift, line 127

I can confirm as well that this fixed the issue (swiftlint/HEAD-10a5826). Thanks for the quick fix and the awesome tool 👍

I confirm that cloning and installing from master has resolved this for me on Xcode 10b3. Thanks and appreciate such an awesome tool!

~I suggest filling bugs with Apple via radar or bugs.swift.org as it looks like it’s something on their side (SourceKitService crashing)~

#2279 should fix it. Sorry about the noise 😅

It seems that in Xcode 10 Beta 3, the issue got worse. Previously, I was getting this error roughly 50% of the time, now it’s closer to 90%.

SwiftLint installed via brew install swiftlint --HEAD (HEAD-1c8d5a4).

Thanks @norio-nomura. I’ve reported it here and here.

@ornithocoder As far as I tested, Swift 4.1.2 is not affected by SR-8315. It would be good to use

SOURCEKIT_LOGGING=3 swift test --filter RulesTests.testAnyObjectProtocol

to check what kind of request is crashing SourceKit and report it to https://bugs.swift.org.