Skip to content

RUM network resources not tracked when URLSessionConfiguration.usesClassicLoadingMode = false (iOS 18.4+) #3012

Description

@StanleyOned

Hey team 👋

We've been trying to fix a recurring crash in our app caused by a race condition in Apple's classic CFNetwork HTTP stack (SIGSEGV SEGV_ACCERR in URLConnectionLoader::loadWithWhatToDo). Apple DTS recommends setting usesClassicLoadingMode = false on URLSessionConfiguration to switch to the newer Network.framework stack and avoid the crash entirely — see this Apple Developer Forums thread.

The problem: when we enable this, all Datadog RUM network resource events disappear completely. Reverting the property brings them back instantly. We upgraded from 3.1.0 to 3.12.0 specifically hoping the 3.7.0 automatic tracking improvements (PR #2672) would fix the incompatibility, but we're still seeing the same issue.


What we're running

  • dd-sdk-ios: 3.12.0
  • iOS: 18.4+ (confirmed on a real device via TestFlight)
  • Networking: Apollo GraphQL (Apollo.URLSessionClient, delegate-based) custom URLSessionFactory, also delegate-based

Our Datadog setup

RUM.enable(
    with: RUM.Configuration(
        applicationID: "...",
        urlSessionTracking: RUM.Configuration.URLSessionTracking(
            firstPartyHostsTracing: .trace(hosts: firstPartyHosts),
            resourceAttributesProvider: { request, _, _, _ in
                guard let op = request.value(forHTTPHeaderField: "X-APOLLO-OPERATION-NAME") else { return nil }
                return ["operation": op]
            }
        ),
        trackBackgroundEvents: false,
        resourceEventMapper: { event in
            let isFirstParty = firstPartyHosts.contains { event.resource.url.contains($0) }
            return isFirstParty ? event : nil
        }
    )
)

The affected URLSession configuration:

if #available(iOS 18.4, *) {
    config.usesClassicLoadingMode = false
}

Everything we tried

We went through several iterations trying to get events to show up:

  1. Deprecated URLSessionInstrumentation.enable(with:) for both Apollo and our custom delegate — no events
  2. URLSessionInstrumentation.enableDurationBreakdown(with:) (the new 3.7.0+ API) for both — no events
  3. Removed all explicit URLSessionInstrumentation calls entirely, relying purely on the automatic tracking from urlSessionTracking — still no events
  4. Reverted usesClassicLoadingMode = false — events appear immediately ✅

So the issue is clearly in the automatic tracking layer itself, not in how we register sessions explicitly.

What we expected

Based on the 3.7.0 changelog and PR #2672, we understood that automatic tracking now wraps completion handlers directly instead of relying on delegate callbacks. We expected this to work regardless of which HTTP stack is active underneath.

What actually happens

Zero RUM resource events are recorded when usesClassicLoadingMode = false is active on a real device, no matter which instrumentation approach we use.


Any guidance on whether this is a known limitation or a bug would be really appreciated. Happy to provide more details or a reproduction project if that helps!

Metadata

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