Open Almaz5200 opened 11 hours ago
Thanks for reporting the issue @Almaz5200. Unfortunately there isn't enough information here to determine the cause. I also cannot replicate the error in our test projects.
If you can supply a standalone project that fails in the same way it would definitely help to debug the issue. If you have the full Xcode build log that may help too.
Thank you for a quick response @calvincestari. I was able to come up with a simple project that replicates the issue: https://github.com/Almaz5200/ApolloSegFault
You should be able to just cd into ApolloCodegen and use swift run
there, see screenshot bellow
Also note, that for demonstration purposes I've hardcoded project root path, so you'll have to change it in order to run it
If you’re unable to reproduce the issue, please let me know, and I’ll gladly share build logs and any other information you may need.
That project isn't failing for me @Almaz5200. There are some oddities in the output but I can get the generated operation as below:
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
import APITypes
public class TestQQuery: GraphQLQuery {
public static let operationName: String = "TestQ"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query TestQ { sectionQueries }"#
))
public init() {}
public struct Data: APITypes.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { APITypes.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("sectionQueries", String.self),
] }
public var sectionQueries: String { __data["sectionQueries"] }
}
}
Which version of Xcode are you using?
I've tried it with Xcode 15.4 and 16.0. It works fine on 15.4 and fails on 16.0 Regarding oddities in the output, I wouldn't read into that too much, I've made this scheme in a rush to be barely valid just for a demonstration, so there may be something wrong with it. In my case however it doesn't seem to even get to validating scheme or parsing it in any way
I've tried it with Xcode 15.4 and 16.0. It works fine on 15.4 and fails on 16.0
Are you using the latest Xcode 16.0 release, build 16A242d
? If you want to send me the Xcode build log I'll take a look at to see if I can glean anything else from that.
Summary
I’m experiencing a runtime crash when using Apollo codegen with Xcode 16 in Swift 5 language mode. The project compiles successfully, but upon running, it crashes with a “Segmentation fault: 11” error. When debugging, the crash points to line 15 in Collection+ConcurrentCompactMap.swift.
Version
1.15.1
Steps to reproduce the behavior
Logs
Anything else?
Here's our full script: