Skip to content

Crash when startWithApplicationToken is called #301

Open
@laurentaylormarshall

Description

Description

On app launch, NewRelic.start(withApplicationToken: [token here]) crashes on iOS 15 and iOS 16 for classes that are marked as only available in iOS 17+. This is most likely the same type of issue as reported here: https://forum.newrelic.com/s/hubtopic/aAX8W0000008caqWAA/xcode-13-ios-14-crash

Steps to Reproduce

  • Create a new project where the minimum deployment is iOS 15.
  • Add the NewRelic.start(withApplicationToken: newRelicKey) method to the app delegate
  • Add a file to the project with the following code:
import SwiftData

@available(iOS 17.0, *)
@Model class SomeModel {
  var someProperty: Bool

  init(someProperty: Bool) {
    self.someProperty = someProperty
  }
}

and/or

import Foundation

@available(iOS 17.0, *)
@Observable class SomeObservable {
  var someProperty: Bool

  init(someProperty: Bool) {
    self.someProperty = someProperty
  }
}
  • Run the app

Expected Behavior

The app should not crash due to New Relic.

Relevant Logs / Console output

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region.  Bytes before following region: 4341972992
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                   102cd4000-106050000 [ 51.5M] r-x/r-x SM=COW  ...7/--.app/--
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [1919]

Triggered by Thread:  0

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   ???                           	               0x0 ???
1   libswiftCore.dylib            	       0x1b27918c8 swift::MetadataCacheEntryBase<(anonymous namespace)::SingletonMetadataCacheEntry, int>::doInitialization(swift::MetadataWaitQueue::Worker&, swift::MetadataRequest) + 468
2   libswiftCore.dylib            	       0x1b27802d8 swift_getSingletonMetadata + 880
3   --                           	       0x1052b4e30 type metadata accessor for SomeObservable + 44
4   libobjc.A.dylib               	       0x1b189c2b4 realizeClassMaybeSwiftMaybeRelock(objc_class*, locker_mixin<lockdebug::lock_mixin<objc_lock_base_t> >&, bool) + 184
5   libobjc.A.dylib               	       0x1b187d7b4 look_up_class + 148
6   NewRelic                      	       0x10aa6e3bc NRMA__generateClassTrees + 136
7   NewRelic                      	       0x10aa6e2cc 0x10aa48000 + 156364
8   libdispatch.dylib             	       0x1bfbd8fdc _dispatch_client_callout + 20
9   libdispatch.dylib             	       0x1bfbda828 _dispatch_once_callout + 32
10  NewRelic                      	       0x10aa6e274 0x10aa48000 + 156276
11  NewRelic                      	       0x10aa74a78 0x10aa48000 + 182904
12  NewRelic                      	       0x10aa7474c 0x10aa48000 + 182092
13  NewRelic                      	       0x10aa77b08 0x10aa48000 + 195336
14  libdispatch.dylib             	       0x1bfbd8fdc _dispatch_client_callout + 20
15  libdispatch.dylib             	       0x1bfbda828 _dispatch_once_callout + 32
16  NewRelic                      	       0x10aa77aa4 0x10aa48000 + 195236
17  NewRelic                      	       0x10aa7782c 0x10aa48000 + 194604
18  --                           	       0x10333a4dc specialized AppDelegate.application(_:didFinishLaunchingWithOptions:) + 3200
19  --                           	       0x103330fb0 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 136
20  UIKitCore                     	       0x1baaeac54 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 300
21  UIKitCore                     	       0x1baaea378 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 2848
22  UIKitCore                     	       0x1baae9354 -[UIApplication _runWithMainScene:transitionContext:completion:] + 856
23  UIKitCore                     	       0x1baae8fcc -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 176
24  UIKitCore                     	       0x1bab337f0 -[UIApplication _compellApplicationLaunchToCompleteUnconditionally] + 48
25  UIKitCore                     	       0x1bab32848 -[UIApplication _run] + 852
26  UIKitCore                     	       0x1bab324d0 UIApplicationMain + 340
27  --                           	       0x103338b3c main + 68
28  dyld                          	       0x1d6e5e960 start + 2528

Your Environment

Xcode 15.4
iOS 16.4 simulator
New Relic v7.5.1 via SPM

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions