Skip to content

Commit 91c5ff4

Browse files
RSNarafacebook-github-bot
authored andcommitted
Guard against nil methodQueue in RCTBlobManager
Summary: ## Description In T63516227, we're seeing a crash that occurs because `networking.methodQueue` is `nil`, and we try to `dispatch_async` to it. ## Hypothesis This looks like a problem with NativeModule cleanup: 1. Some JS executes a call to `RCTBlobManager.addNetworkingHander`. This schedules an async method call on the `RCTBlobManager` method queue. 2. In `RCTCxxBridge invalidate`, on the JS thread, we loop through all the `RCTModuleData`s, and invalidate them. This invalidates our NativeModules (perhaps not all but only `RCTNetworking`). 3. The `RCTBlobManager.addNetworkingHander` method call finally executes, with `RCTNetworking`'s methodQueue set to nil, which throws this error. Changelog: [iOS][Fixed] - Fix RCTBlobManager cleanup crash Reviewed By: PeteTheHeat Differential Revision: D20498096 fbshipit-source-id: d2d60984637ddf883278289258aa9b2ae81bb172
1 parent 48fe460 commit 91c5ff4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Libraries/Blob/RCTBlobManager.mm

+6
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ - (void)remove:(NSString *)blobId
142142
{
143143
RCTNetworking *const networking = _bridge ? _bridge.networking : [_turboModuleLookupDelegate moduleForName:"RCTNetworking"];
144144

145+
// TODO(T63516227): Why can methodQueue be nil here?
146+
// We don't want to do anything when methodQueue is nil.
147+
if (!networking.methodQueue) {
148+
return;
149+
}
150+
145151
dispatch_async(networking.methodQueue, ^{
146152
[networking addRequestHandler:self];
147153
[networking addResponseHandler:self];

0 commit comments

Comments
 (0)