Skip to content

Commit d2af787

Browse files
Mugilan Kumarasamymeta-codesync[bot]
authored andcommitted
Downgrade image timeout in test environment from RCTLogError to RCTLogWarn (#56494)
Summary: Pull Request resolved: #56494 Changelog: [Internal] ## Problem `RCTSyncImageManager` (used exclusively in test environments) calls `RCTLogError` when a network image fails to load within 20 seconds. On iOS, `RCTLogError` triggers a **native redbox** — a full-screen red overlay that: 1. **Covers the entire app UI**, making all elements invisible to E2E test assertions 2. **Cannot be dismissed on iOS** — `NativeExceptionsManager.dismissRedbox()` is a no-op (empty method in `RCTExceptionsManager.mm`) 3. **Cannot be suppressed by JavaScript-side mechanisms** — `LogBox.ignoreAllLogs()` and `suppress_warning` mobile config only affect JS-level LogBox, not native `RCTLogError` redboxes 4. **Instantly fails any E2E test** at the next `toBeVisible()` / `toHaveText()` assertion because the redbox overlay blocks all UI elements This causes **~2-5% infrastructure flakiness** across all iOS E2E tests that render components with network images (e.g., recommendation cards, ad previews, profile images), due to transient image load timeouts in the CI test sandbox. ### Error Flow ``` Image URL request in test sandbox → Network timeout (sandbox cant fetch from lookaside.facebook.com) → RCTSyncImageManager.mm dispatch_group_wait expires (20s) → RCTLogError(@"Image timed out in test environment for url: %@") → RCTLog.mm: level >= RCTLOG_REDBOX_LEVEL → Native RedBox overlay shown (full-screen, undismissable on iOS) → All toBeVisible() assertions fail → Test marked as FAILED ``` Differential Revision: D101052445 fbshipit-source-id: f615ac48ca210c5b070798f95ab2675ab9449e70
1 parent 56129fe commit d2af787

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager

packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTSyncImageManager.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ - (ImageRequest)requestImage:(ImageSource)imageSource surfaceId:(SurfaceId)surfa
9292

9393
auto result = dispatch_group_wait(imageWaitGroup, dispatch_time(DISPATCH_TIME_NOW, 20 * NSEC_PER_SEC));
9494
if (result != 0) {
95-
RCTLogError(@"Image timed out in test environment for url: %@", loaderRequest.imageURL);
95+
// Downgraded from RCTLogError to RCTLogWarn: image timeouts in test
96+
// environments are transient infrastructure issues, not fatal app errors.
97+
// RCTLogError triggers a native redbox that blocks the entire UI and cannot
98+
// be dismissed on iOS, causing E2E test failures.
99+
RCTLogWarn(@"Image timed out in test environment for url: %@", loaderRequest.imageURL);
96100
}
97101
return imageRequest;
98102
}

0 commit comments

Comments
 (0)