Skip to content

[NetworkReporter] Fix resource timing data leaking for failed network requests - #60235

Open
huntie wants to merge 1 commit into
pr60187from
pr60235
Open

huntie wants to merge 1 commit into
pr60187from
pr60235

Conversation

@huntie

@huntie huntie commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

NetworkReporter buffers PerformanceResourceTiming data for every request from reportRequestStart, in all builds, and removes it only in reportResponseEnd. A request that fails or is cancelled keeps its entry for the life of the app.

This affects every failed RCTNetworking and NetworkingModule request, plus any framework reporting through RCTInspectorNetworkReporter or InspectorNetworkReporter. In Expo, where expo-image reports its downloads, a list of images cancels loads as it scrolls, leaking one entry per cancelled image in release builds.

Changes

  • Remove the request's buffered timing data in reportRequestFailed.
  • Drop const from reportRequestFailed, since it modifies the buffer.

Failed requests still report no PerformanceResourceTiming entry.

Changelog:
[General][Fixed] - Web Performance APIs: Fix memory leak of resource timing data for failed network requests

Test Plan

Built Expo's bare-expo app from source against React Native 0.89.0-rc.2, whose copy of these files is identical to main, on an iPhone simulator (iOS 27.2). Fired 200 fetch requests to a closed port over CDP (Runtime.evaluate), counted Network.requestWillBeSent and Network.loadingFailed events, then read the buffer with lldb:

(lldb) expr -D 0 -- ((facebook::react::NetworkReporter*)<instance>)->perfTimingsBuffer_
Build Requests failed Entries left in perfTimingsBuffer_
Before 200 200
After 200 0
  • ✅ Compiled NetworkReporter.cpp for Android (arm64-v8a, NDK clang).

@huntie
huntie changed the base branch from main to pr60187 November 23, 2026 16:23
@huntie
huntie added this pull request to stack #60236 November 23, 2026 16:23
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants