Closed swift-ci closed 4 years ago
@swift-ci create
I'm having trouble building the project, are there any special steps I need to take? I'd like to reproduce the crash locally if possible.
Otherwise, could you attach a full crash log? That might be helpful to see what's going wrong.
Comment by Sergej Jaskiewicz (JIRA)
@mikeash what trouble are you experiencing? I've just clean-cloned the project and built it successfully using SPM.
Here's my terminal output:
sergej@Sergejs-iMac Developer $ git clone https://github.com/Timetable-SPbU/Server.git
Cloning into 'Server'...
remote: Counting objects: 291, done.
remote: Compressing objects: 100% (219/219), done.
remote: Total 291 (delta 164), reused 193 (delta 66), pack-reused 0
Receiving objects: 100% (291/291), 62.67 KiB | 553.00 KiB/s, done.
Resolving deltas: 100% (164/164), done.
sergej@Sergejs-iMac Developer $ cd Server/
sergej@Sergejs-iMac Server (master) $ swiftenv global 4.2
sergej@Sergejs-iMac Server (master) $ swift --version
Apple Swift version 4.2 (swiftlang-1000.0.16.7 clang-1000.10.25.3)
Target: x86_64-apple-darwin18.0.0
sergej@Sergejs-iMac Server (master) $ swift build
Fetching https://github.com/Timetable-SPbU/TimetableSDK.git
Fetching https://github.com/vapor/multipart.git
Fetching https://github.com/vapor/fluent.git
Fetching https://github.com/vapor/crypto.git
Fetching https://github.com/vapor/fluent-postgresql.git
Fetching https://github.com/broadwaylamb/Hammond.git
Fetching https://github.com/vapor/console.git
Fetching https://github.com/vapor/database-kit.git
Fetching https://github.com/vapor/postgresql.git
Fetching https://github.com/apple/swift-nio-ssl-support.git
Fetching https://github.com/dmcyk/CCurl.git
Fetching https://github.com/vapor/validation.git
Fetching https://github.com/vapor/websocket.git
Fetching https://github.com/vapor/core.git
Fetching https://github.com/vapor/template-kit.git
Fetching https://github.com/vapor/sql.git
Fetching https://github.com/apple/swift-nio-ssl.git
Fetching https://github.com/dmcyk/SwiftyCurl.git
Fetching https://github.com/vapor/vapor.git
Fetching https://github.com/vapor/routing.git
Fetching https://github.com/vapor/http.git
Fetching /Users/sergej/Developer/Timetable-SPbU/SPbUappModels
Fetching https://github.com/apple/swift-nio.git
Fetching https://github.com/apple/swift-nio-zlib-support.git
Fetching https://github.com/vapor/service.git
Fetching https://github.com/vapor/url-encoded-form.git
Completed resolution in 18.38s
Cloning https://github.com/vapor/routing.git
Resolving https://github.com/vapor/routing.git at 3.0.1
Cloning https://github.com/vapor/core.git
Resolving https://github.com/vapor/core.git at 3.2.2
Cloning https://github.com/vapor/template-kit.git
Resolving https://github.com/vapor/template-kit.git at 1.0.1
Cloning https://github.com/vapor/validation.git
Resolving https://github.com/vapor/validation.git at 2.0.0
Cloning https://github.com/dmcyk/SwiftyCurl.git
Resolving https://github.com/dmcyk/SwiftyCurl.git at 1.0.0
Cloning /Users/sergej/Developer/Timetable-SPbU/SPbUappModels
Resolving /Users/sergej/Developer/Timetable-SPbU/SPbUappModels at master
Cloning https://github.com/Timetable-SPbU/TimetableSDK.git
Resolving https://github.com/Timetable-SPbU/TimetableSDK.git at master
Cloning https://github.com/broadwaylamb/Hammond.git
Resolving https://github.com/broadwaylamb/Hammond.git at master
Cloning https://github.com/apple/swift-nio-ssl.git
Resolving https://github.com/apple/swift-nio-ssl.git at 1.1.1
Cloning https://github.com/vapor/postgresql.git
Resolving https://github.com/vapor/postgresql.git at 1.0.0-rc.2.2.3
Cloning https://github.com/apple/swift-nio-zlib-support.git
Resolving https://github.com/apple/swift-nio-zlib-support.git at 1.0.0
Cloning https://github.com/dmcyk/CCurl.git
Resolving https://github.com/dmcyk/CCurl.git at 0.2.0
Cloning https://github.com/vapor/vapor.git
Resolving https://github.com/vapor/vapor.git at 3.0.4
Cloning https://github.com/apple/swift-nio.git
Resolving https://github.com/apple/swift-nio.git at 1.8.0
Cloning https://github.com/vapor/http.git
Resolving https://github.com/vapor/http.git at 3.0.7
Cloning https://github.com/vapor/sql.git
Resolving https://github.com/vapor/sql.git at 1.0.0
Cloning https://github.com/vapor/multipart.git
Resolving https://github.com/vapor/multipart.git at 3.0.1
Cloning https://github.com/vapor/websocket.git
Resolving https://github.com/vapor/websocket.git at 1.0.1
Cloning https://github.com/vapor/url-encoded-form.git
Resolving https://github.com/vapor/url-encoded-form.git at 1.0.3
Cloning https://github.com/vapor/fluent.git
Resolving https://github.com/vapor/fluent.git at 3.0.0-rc.2.4.1
Cloning https://github.com/vapor/console.git
Resolving https://github.com/vapor/console.git at 3.0.2
Cloning https://github.com/vapor/database-kit.git
Resolving https://github.com/vapor/database-kit.git at 1.0.1
Cloning https://github.com/vapor/fluent-postgresql.git
Resolving https://github.com/vapor/fluent-postgresql.git at 1.0.0-rc.2.3
Cloning https://github.com/vapor/crypto.git
Resolving https://github.com/vapor/crypto.git at 3.2.0
Cloning https://github.com/apple/swift-nio-ssl-support.git
Resolving https://github.com/apple/swift-nio-ssl-support.git at 1.0.0
Cloning https://github.com/vapor/service.git
Resolving https://github.com/vapor/service.git at 1.0.0
Compile CNIOLinux shim.c
Compile CNIOSHA1 c_nio_sha1.c
Compile CNIOOpenSSL empty.c
Compile CNIOHTTPParser c_nio_http_parser.c
Compile libbcrypt bcrypt.c
Compile CNIOZlib empty.c
Compile libbcrypt blf.c
Compile CNIODarwin shim.c
Compile Swift Module 'SPbUappModelsV1' (4 sources)
Compile Swift Module 'NIOPriorityQueue' (2 sources)
Compile Swift Module 'SQL' (35 sources)
Compile Swift Module 'Hammond' (4 sources)
Compile Swift Module 'Debugging' (3 sources)
Compile Swift Module 'COperatingSystem' (1 sources)
Compile CNIOAtomics src/c-atomics.c
Compile Swift Module 'NIOConcurrencyHelpers' (2 sources)
... here goes a bunch of compiler warnings due to the usage of `@_inlineable` in the swift-nio package
Compile Swift Module 'NIOOpenSSL' (11 sources)
Compile Swift Module 'Random' (4 sources)
Compile Swift Module 'Core' (24 sources)
Compile Swift Module 'NIOWebSocket' (8 sources)
Compile Swift Module 'Validation' (16 sources)
Compile Swift Module 'Logging' (4 sources)
Compile Swift Module 'Multipart' (8 sources)
Compile Swift Module 'URLEncodedForm' (8 sources)
Compile Swift Module 'Service' (20 sources)
Compile Swift Module 'HTTP' (23 sources)
Compile Swift Module 'Crypto' (13 sources)
Compile Swift Module 'Routing' (12 sources)
Compile Swift Module 'TemplateKit' (41 sources)
Compile Swift Module 'Console' (27 sources)
Compile Swift Module 'DatabaseKit' (29 sources)
Compile Swift Module 'WebSocket' (5 sources)
Compile Swift Module 'PostgreSQL' (55 sources)
Compile Swift Module 'Command' (16 sources)
Compile Swift Module 'Fluent' (56 sources)
Compile Swift Module 'Vapor' (76 sources)
Compile Swift Module 'FluentSQL' (15 sources)
Compile Swift Module 'FluentPostgreSQL' (15 sources)
Compile Swift Module 'ServerCore' (30 sources)
Compile Swift Module 'APIVersion1' (2 sources)
Compile Swift Module 'App' (3 sources)
Compile Swift Module 'Run' (1 sources)
Linking ./.build/x86_64-apple-macosx10.10/debug/Run
sergej@Sergejs-iMac Server (master) $ swift run Run
Illegal instruction: 4
sergej@Sergejs-iMac Server (master)
And pretty much the same when building using the generated Xcode project. Which crash log do you mean?
Comment by Sergej Jaskiewicz (JIRA)
Oh, I see, there's a local dependency. I'm sorry. Gonna upload it and make a separate branch.
Comment by Sergej Jaskiewicz (JIRA)
@mikeash I've fixed the problem, now it should build. Please use the `swift-4.2-crash` branch.
Thanks, that seems to work. I hit another problem later on but I think it's related to my local configuration. I'll keep at it.
Just to keep you in the loop, I'm still trying to track this down but I have been able to replicate the crash here, so that's quite helpful!
I ran into this issue as well on another project today; I've added myself as a watcher to keep updated on the status.
Your comment reminded me that I should post another update. I've identified the problem and the outlines of a solution, but I'm still figuring out the details. Meanwhile, another change in the compiler has kicked this code off the bad path and it no longer triggers the crash. I definitely want to fix the underlying problem but you may find some relief from that in the meantime.
@mikeash: It appears that the compiler change to kick this code off the bad path is not included in Xcode 10 beta 4. Is that expected?
Not expected! Here's my simple test case:
import Foundation
public struct Identifier<T> {
var x: UUID
}
final class Address {
var id: Identifier<Address>?
}
print(Address.self)
Does that one work for you? If so, any ideas what might be different about the project where you're still hitting the problem?
Your simple test case does work for me. I'll see if I can reduce my case down into something simpler.
Here's a test case that still fails:
import Foundation
enum MarkdownNode {
case link(destination: URL, children: [MarkdownNode])
static func test2() -> [MarkdownNode] {
return []
}
static func test1() -> [MarkdownNode] {
let nodes = MarkdownNode.test2()
return nodes
}
}
let result = MarkdownNode.test1()
print(result)
with this backtrace:
#​0 0x0000000100d311b1 in _dispatch_gate_wait_slow ()
#​1 0x00000001004c7989 in swift_once ()
#​2 0x00000001000022bf in type metadata accessor for MarkdownNode ()
#​3 0x0000000100002231 in type metadata accessor for [MarkdownNode] ()
#​4 0x0000000100002a10 in ___lldb_unnamed_symbol1$$test ()
#​5 0x0000000100d1fd8f in _dispatch_client_callout ()
#​6 0x0000000100d1fd6f in dispatch_once_f ()
#​7 0x00000001004c7989 in swift_once ()
#​8 0x00000001000022bf in type metadata accessor for MarkdownNode ()
#​9 0x0000000100002198 in static MarkdownNode.test2() ()
#​10 0x00000001000021e9 in static MarkdownNode.test1() at /Users/bjhomer/Desktop/test/test/main.swift:12
Update: Simplified the test case even further.
Perfect, thanks. I can confirm that your example crashes here as well. Hopefully I'll find a proper fix for all of it, but failing that I'll see if I can mitigate it consistently.
Anyone seeing a bug like this that involves an enum
can generally work around it by making a case indirect
. That workaround won't work for a struct
, though.
I have a patch almost complete to fix this for value types.
Value types (including BJ's test case) addressed by https://github.com/apple/swift/pull/18214.
We think this is working on the swift-5.0-branch thanks to Slava's work back in August.
https://github.com/apple/swift/pull/18893
https://github.com/apple/swift/pull/18882
https://github.com/apple/swift/pull/18694
Comment by Matthaus Woolard (JIRA)
I seem to be getting this same crash (signal SIGABRT) on XCode Version 11.2.1 (11B53) (using swift 5) (only when running a release build on the iPad Pro (12.9-inch) (3rd generation) running iOS 13.2 (17B84) (we were not able to reproduce this on our phones)
For reference the line of code
```swift
print(JWT\<JWTFields>.self)
```
The `JWT` type here is the struct from `https://github.com/IBM-Swift/Swift-JWT`.
```
Thread 3 Queue : com.test.purchases.serial (serial)
Thread 3 Queue : com.test.purchases.serial (serial)
#0 0x0000000187bd0efc in __pthread_kill ()
#1 0x0000000187af0d10 in pthread_kill ()
#2 0x0000000187a80a74 in abort ()
#3 0x00000001956d52a4 in swift_runtime_unreachable(char const*) ()
#4 0x00000001956d6e34 in swift_getWitnessTable ()
#5 0x0000000104e893d4 in lazy protocol witness table accessor for type JWTFields and conformance JWTFields [inlined] ()
#6 0x0000000104e893b4 in type metadata accessor for JWT\<JWTFields> [inlined] ()
#7 0x0000000104e893a8 in specialized JWTProcessor.verifySignature(jwtString🙂 at *****/JWTProcessor.swift:28
#8 0x0000000104e5b480 in JWTProcessor.verifySignature(jwtString🙂 [inlined] ()
#9 0x0000000104e5b478 in specialized KeychainManager.checkKeychainLicense(completion🙂 at *****/KeychainManager.swift:63
#10 0x0000000104e4c360 in specialized KeychainManager.checkKeychainLicense(completion🙂 [inlined] ()
#11 0x0000000104e4c34c in closure
#3 in LicenseStateManager.checkLicenseState() at *****/LicenseStateManager.swift:85
#12 0x0000000104ea3a14 in thunk for @escaping @callee_guaranteed () -> () ()
#13 0x0000000105351e1c in _dispatch_call_block_and_release ()
#14 0x000000010535327c in _dispatch_client_callout ()
#15 0x000000010535a90c in _dispatch_lane_serial_drain ()
#16 0x000000010535b4fc in _dispatch_lane_invoke ()
#17 0x00000001053664dc in _dispatch_workloop_worker_thread ()
#18 0x0000000187af1a94 in _pthread_wqthread ()
```
Environment
Xcode 10 beta (10L176w), macOS 10.14 Beta (18A293u) Apple Swift version 4.2 (swiftlang-1000.0.16.7 clang-1000.10.25.3)Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 1 | |Component/s | Compiler | |Labels | Bug, 4.2Regression, RunTimeCrash | |Assignee | broadway_lamb (JIRA) | |Priority | Medium | md5: 9657a246ce8b2e208b6a48ea60850d24is duplicated by:
Issue Description:
I'm experiencing a runtime crash when running my Vapor 3 project after I compile it with Xcode 10 beta. I didn't have this issue previously with Xcode 9/Swift 4.1
Stacktrace:
The project itself can be found at https://github.com/Timetable-SPbU/Server.