Fix onHostPause crash in ReactInstanceManager without feature flag#55986
Closed
shubhamksavita wants to merge 1 commit intofacebook:mainfrom
Closed
Fix onHostPause crash in ReactInstanceManager without feature flag#55986shubhamksavita wants to merge 1 commit intofacebook:mainfrom
shubhamksavita wants to merge 1 commit intofacebook:mainfrom
Conversation
|
@shubhamksavita has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95570941. |
…acebook#55986) Summary: Pull Request resolved: facebook#55986 This fixes the `java.lang.AssertionError` crash in `ReactInstanceManager.onHostPause()` for third-party React Native apps (primarily Discord at 95.9% of crashes) using the deprecated bridge mode. ## Problem When VROS triggers Activity lifecycle transitions that cause two Activity instances to exist simultaneously, the reference equality assertion in `onHostPause()` crashes. D95309454 attempted to fix this by gating behind `ReactNativeFeatureFlags.skipActivityIdentityAssertionOnHostPause()`, but that flag has `ossReleaseStage: 'none'`, meaning OSS users can't benefit from the fix. ## Solution Instead of gating behind a feature flag, always log a warning instead of crashing with an assertion. This is safe because: - `ReactInstanceManager` is deprecated bridge-mode code - The flag's `expectedReleaseValue` is `true` (intended to always skip the assertion) - The bridgeless architecture (`ReactHostImpl.kt`) already has the same behavior - This avoids the GitHub export issue where the flag defaults to `false` for OSS ## Stats - 365 crashes in 14 days across 8 third-party apps - All Quest devices affected (Q2, Q3, Q3S) - All active branches (v85, v201, v83) ## Changes - Modified `onHostPause()` to log a warning via `FLog.w()` instead of crashing via `Assertions.assertCondition()` when the paused activity doesn't match the current activity - Added null safety for the activity parameter in the log message - No new imports needed (removed dependency on `ReactNativeFeatureFlags`) Differential Revision: D95570941
64fe458 to
ece4eac
Compare
cortinico
approved these changes
Mar 7, 2026
Contributor
cortinico
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Collaborator
|
This pull request was successfully merged by @shubhamksavita in 3aa8a04 When will my fix make it into a release? | How to file a pick request? |
|
This pull request has been merged in 3aa8a04. |
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:
This fixes the
java.lang.AssertionErrorcrash inReactInstanceManager.onHostPause()for third-party React Native apps (primarily Discord at 95.9% of crashes) using the deprecated bridge mode.Problem
When VROS triggers Activity lifecycle transitions that cause two Activity instances to exist simultaneously, the reference equality assertion in
onHostPause()crashes. D95309454 attempted to fix this by gating behindReactNativeFeatureFlags.skipActivityIdentityAssertionOnHostPause(), but that flag hasossReleaseStage: 'none', meaning OSS users can't benefit from the fix.Solution
Instead of gating behind a feature flag, always log a warning instead of crashing with an assertion. This is safe because:
ReactInstanceManageris deprecated bridge-mode codeexpectedReleaseValueistrue(intended to always skip the assertion)ReactHostImpl.kt) already has the same behaviorfalsefor OSSStats
Changes
onHostPause()to log a warning viaFLog.w()instead of crashing viaAssertions.assertCondition()when the paused activity doesn't match the current activityReactNativeFeatureFlags)Differential Revision: D95570941