Repository navigation
Conversation
Visual regressionNo visual differences at android: no capture |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RCTInspectorNetworkReporterbuffers incremental text response bodies in a globalNSMutableDictionarywith no lock.RCTNetworkingonly reaches it from one serial queue, but the class is public, and a second reporter callingreportResponseEndfrom another queue, as Expo's does from itsURLSessiondelegate, mutates the dictionary whileRCTNetworkingappends to it.Changes
responseBuffersaccess with onestd::mutex.storeResponseBodyafter releasing the lock, so it never nests withNetworkReporter's own locks.REACT_NATIVE_DEBUGGER_ENABLED, so release builds are unchanged.Changelog:
[iOS][Fixed] - React Native DevTools: Fix a data race when another reporter ends a request while
RCTNetworkingbuffers a response bodyTest Plan
Built an Expo app on React Native 0.89.0-rc.0, whose copy of this file is identical to
main, from source with Thread Sanitizer, on an iPhone simulator (iOS 27.2). A local server streamed 40 chunked text lines per response; each round sent 60 XHR text requests throughRCTNetworkingand 60expo/fetchrequests at once, with the Network domain enabled over CDP.maybeStoreResponseBodyIncrementalandRCTNetworking'sreportResponseEndran oncom.meta.react.turbomodulemanager.queue, while Expo'sreportResponseEndran oncom.apple.NSURLSession-delegate, so the race is reachable.Network.getResponseBodyreturned all 40 lines for 300 of 300 XHR and 300 of 300expo/fetchrequests.