-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[SR-7876] Runtime crash on 'type metadata accessor for %Typename%' #50411
Comments
@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. |
|
@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 |
I have a patch almost complete to fix this for value types. |
Value types (including BJ's test case) addressed by #18214 |
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 print(JWT<JWTFields>.self) The `JWT` type here is the struct from `https://github.com/IBM-Swift/Swift-JWT`. ``` |
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
md5: 9657a246ce8b2e208b6a48ea60850d24
is 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.
The text was updated successfully, but these errors were encountered: