Skip to content

iOS: Session Replay network-detail capture breaks requests on sentry-cocoa 9.25.0 #6609

Closed

Description

@antonis

Summary

After bumping sentry-cocoa 9.24.0 → 9.26.0 (#6409), the iOS E2E flow captureSpaceflightNewsScreenTransaction.test.ios.auto began failing deterministically on main and every PR. The flow fails at No visible element found: "Load More Articles" because the article fetch never completes, so the list never renders.

Root cause is in sentry-cocoa 9.26.0, not in RN JS/bridge code: with 9.26.0, an outbound URLSession request to a URL on the Session Replay network-detail allow-list (with body capture enabled) does not complete. This is a functional networking regression, not just telemetry loss.

Why this matters (user impact)

Any app on sentry-cocoa 9.26.0 using Session Replay with networkDetailAllowUrls + networkCaptureBodies will have its requests to those hosts broken. Bounded to allow-listed network-detail URLs; other traffic is unaffected. In @sentry/react-native this surfaces on iOS because the native SDK performs the URLSession instrumentation.

Evidence — three-way E2E bisect (single variable each)

The sample's mobileReplayIntegration in samples/react-native/src/App.tsx configures network-detail capture for exactly the failing host:

Sentry.mobileReplayIntegration({
  networkDetailAllowUrls: ['https://api.spaceflightnewsapi.net'],
  networkCaptureBodies: true,
})
sentry-cocoa Replay network-detail capture Spaceflight iOS flow CI run
9.26.0 on ❌ red (4/4 deterministic) 32713642451
9.24.0 on ✅ green 32722276675
9.26.0 off ✅ green 32725506585

Two independent single-variable flips each turn it green → the trigger is 9.26.0's Session Replay network-detail path. It is the only iOS flow making a real external HTTP request, and the only one that failed; all other iOS flows passed in every run.

Suspected upstream cause (to pass to sentry-cocoa)

getsentry/sentry-cocoa#8497 — "Prevent Session Replay network-detail breadcrumbs from blocking URLSession cancellation on the task monitor" — the only 9.26.0 change touching both the network-detail path and URLSession lifecycle.

Ruled out: getsentry/sentry-cocoa#8650 (trace-header copy-and-replace setter) — not gated on replay network-detail, so disabling network-detail would not have fixed it. Last-known-good is 9.24.0 (9.25.0 shipped no networking changes per the cocoa changelog).

Verification for the cocoa team: revert #8497 on a 9.26.0 build (or bisect 9.25.0→9.26.0) against the repro below.

Reproduction

  1. @sentry/react-native on iOS with sentry-cocoa 9.26.0, Session Replay enabled.
  2. Configure mobileReplayIntegration with networkDetailAllowUrls: ['<host>'] and networkCaptureBodies: true.
  3. From the app, issue a GET to a URL on that host (e.g. https://api.spaceflightnewsapi.net/v4/articles).
  4. Observe: the request does not complete; the response body never reaches the app. Deterministic.

Current state / workaround

  • Interim options: hold the RN cocoa pin at 9.24.0, or (for users) disable networkCaptureBodies / drop affected hosts from networkDetailAllowUrls on 9.26.0.
  • A proof branch demonstrating the third bisect row (removes the two options from the sample; iOS E2E green on 9.26.0) was used to isolate this and has been closed — it was a reproduction, not a merge candidate.

Next steps

  • File/track the upstream sentry-cocoa issue (suspected #8497) — this ticket is the reference.
  • Once cocoa ships the fix, re-apply the 9.26.0 bump and restore the network-detail options in the sample.
  • Watch for cold-start flakiness on re-land and re-add a readiness gate if needed.

Activity

  1. linear-code commented on Aug 24, 2026

    @linear-code
  2. self-assigned this
    on Aug 24, 2026
  3. antonis commented on Aug 25, 2026

    @antonis
    ContributorAuthor

    Update — corrected bisect: the regression is in 9.25.0, not 9.26.0, and the trigger is the Objective-C → Swift port of SentryNetworkTracker (getsentry/sentry-cocoa#8502).

    Running the bisect one version finer overturns the conclusion in the original write-up above.

    sentry-cocoa Replay network-detail capture Spaceflight iOS flow CI evidence
    9.26.0 on ❌ red (as above)
    9.25.0 on ❌ red — No visible element: "Load More Articles", 29 s, healthy driver run 32842965136, job 97803444324
    9.24.0 on ✅ green — re-confirmed under current CI run 32855896390, job 97831246365

    So 9.25.0 is already broken — the earlier note that "9.25.0 shipped no networking changes per the cocoa changelog" is incorrect. The 9.24.0 → 9.25.0 range contains the network-tracker rewrite:

    • ref: convert SentryNetworkTracker to Swift sentry-cocoa#8502 — convert SentryNetworkTracker to Swift — deletes SentryNetworkTracker.m (776 lines), adds SentryNetworkTracker.swift (675 lines) plus a new URLSessionTask+AssociatedValues.swift. This is exactly the delegate-path code RN's RCTHTTPRequestHandler exercises (urlSessionTask:setState: → captureRequestDetails).

    Revised suspect: #8502, not #8497. #8497 ("avoid URLSession task monitor contention") landed in 9.26.0 — after the regression already existed in 9.25.0 — and only modifies the dataTask(with:completionHandler:) path, which RN's delegate-based networking never takes. For the same reason, getsentry/sentry-cocoa#8852 cannot fix the RN path.

    New symptom detail: on-device this is a native crash, not just a stalled request. Opening the Spaceflight News screen in the sample crashes the app. In the 9.25.0 Swift port, per-task state (span, start date, breadcrumb flag, and the Replay networkDetails) is stored on the URLSessionTask via associated objects (AssociatedObjectAccessor in the new URLSessionTask+AssociatedValues.swift) and read back from the setState: swizzle. Associated-object storage on NSURLSessionTask (a class-cluster type, wrapped by the KVO/swizzle dynamic subclass) is a known native-crash surface and is new in #8502 — leading suspect for the crash. A captured crash report is available internally.

    For the cocoa team: bisect 9.24.0 → 9.25.0 (not 9.25.0 → 9.26.0) and focus on #8502. Last-known-good remains 9.24.0.

  4. changed the title [-]iOS: Session Replay network-detail capture breaks requests on sentry-cocoa 9.26.0 (Spaceflight E2E regression)[/-] [+]iOS: Session Replay network-detail capture breaks requests on sentry-cocoa 9.25.0[/+] on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions