Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift build and swift package describe SIGSEGV #3018

Open
finestructure opened this issue Apr 25, 2024 · 6 comments
Open

swift build and swift package describe SIGSEGV #3018

finestructure opened this issue Apr 25, 2024 · 6 comments

Comments

@finestructure
Copy link
Member

finestructure commented Apr 25, 2024

Using Swift 6 preview toolchains to dump the package description causes a SIGSEGV:

git clone https://github.com/SwiftPackageIndex/SemanticVersion && cd SemanticVersion
env DEVELOPER_DIR=/Applications/Xcode-15.3.0.app xcrun --toolchain $TOOLCHAIN_ID swift package describe --type json
❯ git clone https://github.com/SwiftPackageIndex/SemanticVersion && cd SemanticVersion
Cloning into 'SemanticVersion'...
remote: Enumerating objects: 293, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 293 (delta 11), reused 15 (delta 4), pack-reused 246
Receiving objects: 100% (293/293), 66.75 KiB | 976.00 KiB/s, done.
Resolving deltas: 100% (127/127), done.
~/D/SemanticVersion on main
❯ env DEVELOPER_DIR=/Applications/Xcode-15.3.0.app xcrun --toolchain org.swift.600202404221a swift package describe --type json
fish: Job 1, 'env DEVELOPER_DIR=/Applications…' terminated by signal SIGSEGV (Address boundary error)

Tested with toolchains from April 15 and April 22.

Status Date Toolchain ID
Feb 29 org.swift.59202402291a
Mar 26 org.swift.59202403261a
Mar 30 org.swift.59202403301a
Apr 01 org.swift.59202404011a
Apr 26 org.swift.59202404261a
Apr 15 org.swift.600202404151a
Apr 22 org.swift.600202404221a
Apr 26 org.swift.59202404261a
Apr 30 org.swift.600202404301a
@finestructure finestructure changed the title swift package describe SIGSEGV swift build and swift package describe SIGSEGV Apr 26, 2024
@finestructure
Copy link
Member Author

finestructure commented Apr 26, 2024

What's worse, it also crashes when building Vapor:

git clone https://github.com/vapor/vapor && cd vapor
env DEVELOPER_DIR=/Applications/Xcode-15.3.0.app xcrun --toolchain $TOOLCHAIN_ID swift build

It also crashes when running with Xcode 15.4b1:

env DEVELOPER_DIR=/Applications/Xcode-15.4.0-Beta.app xcrun --toolchain $TOOLCHAIN_ID swift build

We've reproduced this on two different machines.

@finestructure
Copy link
Member Author

finestructure commented Apr 28, 2024

Turns out the Vapor builds are broken for all recent toolchains on my machine:

Status Date Toolchain ID
Feb 29 org.swift.59202402291a
Mar 26 org.swift.59202403261a
Mar 30 org.swift.59202403301a
Apr 01 org.swift.59202404011a
Apr 15 org.swift.600202404151a
Apr 22 org.swift.600202404221a
Apr 26 org.swift.59202404261a

This includes the two toolchains we ran our preview on. However, when I look through the preview logs I see that these passed:

Run 2:

CleanShot 2024-04-28 at 12 46 12@2x

[1734/1738] Compiling XCTVapor Exports.swift
[1735/1738] Compiling XCTVapor XCTApplication.swift
[1736/1738] Compiling XCTVapor Utilities.swift
[1737/1738] Emitting module XCTVapor
[1738/1738] Compiling XCTVapor XCTHTTPRequest.swift
Build complete! (138.63s)

Run 1:

CleanShot 2024-04-28 at 12 49 57@2x

[1735/1738] Compiling XCTVapor XCTVaporTests.swift
[1736/1738] Emitting module XCTVapor
[1737/1738] Compiling XCTVapor Exports.swift
[1738/1738] Compiling XCTVapor XCTApplication.swift
/Users/builder/builds/TDmZkXJm/2/finestructure/swiftpackageindex-builder/spi-builder-workspace/Sources/Vapor/HTTP/Headers/HTTPHeaders+Name.swift:103:27: warning: static property 'contentLength' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6
101 │         public static let contentLanguage = Name("Content-Language")
102 │         /// Content-Length header.
103 │         public static let contentLength = Name("Content-Length")
    │                           ╰─ warning: static property 'contentLength' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6
104 │         /// Content-Location header.
105 │         public static let contentLocation = Name("Content-Location")
Build complete! (159.59s)

Something must be messed up on my machine (and Dave's!) when testing this. I'll re-test on an actual builder.

@finestructure
Copy link
Member Author

Ok, this is probably not affecting the builders. I've just cloned sonoma-5.9-a on the m2 mini:

tart clone sonoma-5.9-a s6-test

and installed the April 22 toolchain org.swift.600202404221a and both the package describe and the Vapor build succeed. There are no crashes on that VM. This will probably also be the case for our other swift-6 builder mb6 as well as the swift-6 orka images.

I'll confirm for the Orka images since those are the ones we'll actually use for the next run.

@finestructure
Copy link
Member Author

finestructure commented Apr 28, 2024

Ok, the bad news is that this crashes on the Orka builder:

swift6:~ $ export TOOLCHAIN_ID=org.swift.600202404221a
swift6:~ $ git clone https://github.com/SwiftPackageIndex/SemanticVersion && cd SemanticVersion
env DEVELOPER_DIR=/Applications/Xcode-15.3.0.app xcrun --toolchain $TOOLCHAIN_ID swift package describe --type json
Cloning into 'SemanticVersion'...
remote: Enumerating objects: 293, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 293 (delta 11), reused 15 (delta 4), pack-reused 246
Receiving objects: 100% (293/293), 66.75 KiB | 704.00 KiB/s, done.
Resolving deltas: 100% (127/127), done.
[1]    3991 segmentation fault  env DEVELOPER_DIR=/Applications/Xcode-15.3.0.app xcrun --toolchain  swift

NB: I ran this on the currently running instance vm-ftqr2, because I couldn't spin up a fresh swift-6 builder:

❯ orka3 vm deploy --config swift-6
Error: admission webhook "mvirtualmachineinstance.kb.io" denied the request: VirtualMachineConfig.orka.macstadium.com "swift-6" not found

I also tried --config swift.6.0 (fails) and --config swift-5.10 (succeeds). Might be something around config visibility? Probably doesn't affect our normal deployment process.

@finestructure
Copy link
Member Author

PS: the Vapor build also crashes on the Orka builder:

Computing version for https://github.com/apple/swift-metrics.git
Computed https://github.com/apple/swift-metrics.git at 2.4.1 (0.50s)
Computing version for https://github.com/apple/swift-crypto.git
Computed https://github.com/apple/swift-crypto.git at 3.3.0 (0.41s)
[1]    4145 segmentation fault  env DEVELOPER_DIR=/Applications/Xcode-15.3.0.app xcrun --toolchain  swift

@finestructure
Copy link
Member Author

Good news! We've got a new Orka base image with Sonoma 14.3.1 which doesn't crash. (The underlying issue is one in SwiftPM with newer macOS versions: apple/swift#73327)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant