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

Xcode 15 builds crash on iOS 16 #1880

Closed
anuragajwani opened this issue Jun 4, 2024 · 9 comments
Closed

Xcode 15 builds crash on iOS 16 #1880

anuragajwani opened this issue Jun 4, 2024 · 9 comments
Labels
crash SDK crashes

Comments

@anuragajwani
Copy link

anuragajwani commented Jun 4, 2024

Stack trace

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
    frame #1: 0x0000000106cf6fbc DatadogCore`specialized DatadogContextProvider.__allocating_init(site:clientToken:service:env:version:buildNumber:buildId:variant:source:nativeSourceOverride:sdkVersion:ciAppOrigin:applicationName:applicationBundleIdentifier:applicationVersion:sdkInitDate:device:dateProvider:serverDateProvider:) [inlined] Network.NWPathMonitor.__allocating_init() -> Network.NWPathMonitor at <compiler-generated>:0 [opt]
  * frame #2: 0x0000000106cf6fb4 DatadogCore`specialized DatadogContextProvider.__allocating_init(site:clientToken:service:env:version:buildNumber:buildId:variant:source:nativeSourceOverride:sdkVersion:ciAppOrigin:applicationName:applicationBundleIdentifier:applicationVersion:sdkInitDate:device:dateProvider:serverDateProvider:) [inlined] default argument 0 of DatadogCore.NWPathMonitorPublisher.init(monitor: Network.NWPathMonitor, queue: __C.OS_dispatch_queue) -> DatadogCore.NWPathMonitorPublisher at NetworkConnectionInfoPublisher.swift:36:35 [opt]
    frame #3: 0x0000000106cf6fb4 DatadogCore`specialized DatadogContextProvider.__allocating_init(site=<unavailable>, clientToken=<unavailable>, service=<unavailable>, env=<unavailable>, buildNumber="1", buildId=nil, variant=nil, source="ios", nativeSourceOverride=nil, sdkVersion="2.12.0", ciAppOrigin=nil, applicationName="TK Staging", applicationBundleIdentifier="com.travelperk.tkapp.preproduction", applicationVersion="3.8.0", sdkInitDate=2024-06-04 12:21:15 UTC, device=DatadogInternal.DeviceInfo @ 0x000000016dbb3a30, dateProvider=DatadogInternal.SystemDateProvider @ 0x000000016dbb3720, serverDateProvider=0x0000000280999280) at DatadogCore.swift:432:74 [opt]
    frame #4: 0x0000000106cecf54 DatadogCore`specialized static Datadog.initializeOrThrow(with:trackingConsent:instanceName:) [inlined] DatadogCore.DatadogContextProvider.__allocating_init(site: DatadogInternal.DatadogSite, clientToken: Swift.String, service: Swift.String, env: Swift.String, version: Swift.String, buildNumber: Swift.String, buildId: Swift.Optional<Swift.String>, variant: Swift.Optional<Swift.String>, source: Swift.String, nativeSourceOverride: Swift.Optional<Swift.String>, sdkVersion: Swift.String, ciAppOrigin: Swift.Optional<Swift.String>, applicationName: Swift.String, applicationBundleIdentifier: Swift.String, applicationVersion: Swift.String, sdkInitDate: Foundation.Date, device: DatadogInternal.DeviceInfo, dateProvider: DatadogInternal.DateProvider, serverDateProvider: DatadogCore.ServerDateProvider) -> DatadogCore.DatadogContextProvider at <compiler-generated>:0 [opt]
    frame #5: 0x0000000106cece8c DatadogCore`specialized static Datadog.initializeOrThrow(configuration=DatadogCore.Datadog.Configuration @ 0x000000016dbb4498, trackingConsent=granted, instanceName="main") at Datadog.swift:447:30 [opt]
    frame #6: 0x0000000106ce88e8 DatadogCore`static Datadog.initialize(with:trackingConsent:instanceName:) [inlined] static DatadogCore.Datadog.initializeOrThrow(with: DatadogCore.Datadog.Configuration, trackingConsent: DatadogInternal.TrackingConsent, instanceName: Swift.String) throws -> DatadogInternal.DatadogCoreProtocol at <compiler-generated>:0 [opt]
    frame #7: 0x0000000106ce88e0 DatadogCore`static Datadog.initialize(configuration=<unavailable>, trackingConsent=<unavailable>, instanceName=<unavailable>, self=DatadogCore.Datadog) at Datadog.swift:384:24 [opt]
    frame #8: 0x0000000102269dc8 TK Staging`DatadogApplicationMonitor.startDatadog(self=TK_Staging.DatadogApplicationMonitor @ 0x00000002837c5eb0) at DatadogApplicationMonitor.swift:51:17
    frame #9: 0x0000000102269a04 TK Staging`DatadogApplicationMonitor.start(self=TK_Staging.DatadogApplicationMonitor @ 0x00000002837c5eb0) at DatadogApplicationMonitor.swift:32:9
    frame #10: 0x000000010226ab64 MyApp`protocol witness for ApplicationMonitoring.start() in conformance DatadogApplicationMonitor at <compiler-generated>:0

Reproduction steps

Tech Stack:

  • Carthage (0.39.1)
  • Xcode 15.4
  • iOS app targeting minimum deployment target on 16.0
  1. Add the following to the Carfile:
github "Datadog/dd-sdk-ios" ~> 2.12.0
  1. Run carthage update --platform iOS --use-xcframeworks --no-use-binaries.

  2. Add binaries of DataDog and OpenTelemetryApi to app.

  3. Initialise DataDog on launch, here is our config:

        let environment = AppConfiguration.current.environmentConfiguration.environment
        let datadogConfiguration = DatadogConfiguration(
            environmentName: environment.datadogName,
            shouldLogToConsole: environment == .staging
        )

        var configuration = Datadog.Configuration(clientToken: thirdPartyKeys.datadogClientToken, env: datadogConfiguration.environmentName)
        configuration.service = "ios"
        configuration.site = .eu1

        Datadog.initialize(
            with: configuration,
            trackingConsent: .granted
        )

        var rumConfiguration = RUM.Configuration(applicationID: thirdPartyKeys.datadogApplicationId)
        rumConfiguration.uiKitActionsPredicate = DefaultUIKitRUMActionsPredicate()
        rumConfiguration.uiKitViewsPredicate = DatadogRUMViewsPredicate()
        rumConfiguration.urlSessionTracking = RUM.Configuration.URLSessionTracking(
            firstPartyHostsTracing: .trace(hosts: Set(String.allBaseDomains))
        )

        RUM.enable(with: rumConfiguration)

        Logs.enable()
        let logger = buildLogger(datadogConfiguration: datadogConfiguration)
        logger.info("Logger and RUMMonitor initialized")

        let rum = RUMMonitor.shared()
        for (key, value) in Self.customAttributes {
            rum.addAttribute(forKey: key, value: value)
        }

        MXMetricManager.shared.add(mxMetricDataDogService)
  1. Run app on physical device running iOS 16.x.x

  2. See it crash on launch

Volume

100% on iOS 16.x.x

Affected SDK versions

2.11.0, 2.12.0

Latest working SDK version

2.11.0 using GH release binary

Does the crash manifest in the latest SDK version?

Yes

Deployment Target

16.0

Device Information

All affected crashes were reported only on iOS 16.x.x only when built through Carthage. Same version of DD did not crash when using the binary/xcframework provided in GH releases tab.

Other relevant information

No response

@anuragajwani anuragajwani added the crash SDK crashes label Jun 4, 2024
@maxep
Copy link
Member

maxep commented Jun 4, 2024

Hi @anuragajwani 👋

I hope you don't mind that I reformatted your report.

I'm not able to reproduce the issue using the following project: OTelCarthage.zip
Could you please provide a sample project that replicate the crash? What you describe is very similar to #1509 so there might be an issue re. the minimum target.

I don't see any configuration of DatadogTrace in your snippet, so I wondering if you need to add OpenTelemetryApi as a dependency.

@maxep maxep added the awaiting response Waiting for response / confirmation from the reporter label Jun 4, 2024
@JonathanFuentesF
Copy link

Hi @anuragajwani, reported issue: #1875 I made a mistake, I'm using SDK ver 2.11.0 and crash is still happening.
Screenshot 2024-06-04 at 11 21 05 AM

@anuragajwani
Copy link
Author

anuragajwani commented Jun 6, 2024

Hi @anuragajwani 👋

I hope you don't mind that I reformatted your report.

I'm not able to reproduce the issue using the following project: OTelCarthage.zip Could you please provide a sample project that replicate the crash? What you describe is very similar to #1509 so there might be an issue re. the minimum target.

I don't see any configuration of DatadogTrace in your snippet, so I wondering if you need to add OpenTelemetryApi as a dependency.

I hope you don't mind that I reformatted your report.

Yes no worries fine with that.

so I wondering if you need to add OpenTelemetryApi

This seems to be only needed in 2.12.0. However we experienced the issue in 2.11.0 too where there doesn't seem to be OpenTelemetryApi.

I'll create a sample project. See if I can reproduce this. However I will have to test this next week as I don't have a device on iOS 16.x.x. I will need to re-borrow the device from a colleague when I see them next week.

@maxep maxep removed the awaiting response Waiting for response / confirmation from the reporter label Jun 6, 2024
@maxep
Copy link
Member

maxep commented Jun 7, 2024

Hey @anuragajwani & @JonathanFuentesF 👋

We have acknowledge the issue by running on a physical iOS 16 device. The problem is that our SDK still target iOS 11 as a minimum target, by running carthage with --no-use-binaries you are rebuilding the SDK with Xcode 15 and face the same crash as described in #1509.

As a workaround while we work on a fix, you can link our prebuilt xcframeworks with carthage update --platform iOS --use-xcframeworks. Please let us know if that works for you, sorry for the inconvenience.

@maxep maxep changed the title Crash on iOS 16 Xcode 15 builds crash on iOS 16 Jun 7, 2024
@JonathanFuentesF
Copy link

@maxep Thanks for sharing, in my case I'm using cocoa pods what would be the equivalent fix? thanks

@maxep
Copy link
Member

maxep commented Jun 7, 2024

@JonathanFuentesF For CocoaPods, you can follow the suggestion in #1509 (comment)

@anuragajwani
Copy link
Author

Thanks for looking into it.

As a workaround while we work on a fix, you can link our prebuilt xcframeworks with carthage update --platform iOS --use-xcframeworks

Currently we are using the xcframework published on the release tab as a workaround. However we would like to recompile datadog with the current xcode version that we are using.

@ganeshnj
Copy link
Contributor

We have released 2.13.0 which contains the fix.

@maxep
Copy link
Member

maxep commented Jul 2, 2024

Hey @anuragajwani 👋

I have validated that 2.13.0 does fix the issue, you can now recompile with you current version of Xcode.

@maxep maxep closed this as completed Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash SDK crashes
Projects
None yet
Development

No branches or pull requests

4 participants