Skip to content

Commit 8636cad

Browse files
Abbondanzometa-codesync[bot]
authored andcommitted
Remove fixFindShadowNodeByTagRaceCondition feature flag (#56850)
Summary: Pull Request resolved: #56850 The `fixFindShadowNodeByTagRaceCondition` feature flag has been fully rolled out on both iOS and Android. This change removes the flag and makes the fixed behavior the permanent default. The fix (#55751) replaced a use-after-free race condition in `findShadowNodeByTag_DEPRECATED` where a raw pointer was captured via `tryCommit()` and could dangle after a concurrent surface stop. The fixed code path uses `getCurrentRevision()` which returns a `shared_ptr` that keeps the root alive for the entire traversal. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D105322626 fbshipit-source-id: 018a6a3646bbca9e8f7854848a8a3ea5f2dbf1d0
1 parent e705e8d commit 8636cad

22 files changed

Lines changed: 59 additions & 249 deletions

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<4342ccb696b4123b9d463a31c024b9bc>>
7+
* @generated SignedSource<<794be726d31bf395558bb987d94c3205>>
88
*/
99

1010
/**
@@ -354,12 +354,6 @@ public object ReactNativeFeatureFlags {
354354
@JvmStatic
355355
public fun fixDifferentiatorParentTagForUnflattenCase(): Boolean = accessor.fixDifferentiatorParentTagForUnflattenCase()
356356

357-
/**
358-
* Fix a use-after-free race condition in findShadowNodeByTag_DEPRECATED by using getCurrentRevision() instead of tryCommit() with a raw pointer.
359-
*/
360-
@JvmStatic
361-
public fun fixFindShadowNodeByTagRaceCondition(): Boolean = accessor.fixFindShadowNodeByTagRaceCondition()
362-
363357
/**
364358
* Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
365359
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<ec375fbc64b2b2b8995c1640a0369923>>
7+
* @generated SignedSource<<e91fab99f355307aac38de7a5c84e8dd>>
88
*/
99

1010
/**
@@ -74,7 +74,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
7474
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
7575
private var enableVirtualViewDebugFeaturesCache: Boolean? = null
7676
private var fixDifferentiatorParentTagForUnflattenCaseCache: Boolean? = null
77-
private var fixFindShadowNodeByTagRaceConditionCache: Boolean? = null
7877
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
7978
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
8079
private var fuseboxAssertSingleHostStateCache: Boolean? = null
@@ -599,15 +598,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
599598
return cached
600599
}
601600

602-
override fun fixFindShadowNodeByTagRaceCondition(): Boolean {
603-
var cached = fixFindShadowNodeByTagRaceConditionCache
604-
if (cached == null) {
605-
cached = ReactNativeFeatureFlagsCxxInterop.fixFindShadowNodeByTagRaceCondition()
606-
fixFindShadowNodeByTagRaceConditionCache = cached
607-
}
608-
return cached
609-
}
610-
611601
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean {
612602
var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache
613603
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<81989dbed82df7bd963d8023c595ff44>>
7+
* @generated SignedSource<<9d1f725d5a1348a2b31ad4ea2242529c>>
88
*/
99

1010
/**
@@ -136,8 +136,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
136136

137137
@DoNotStrip @JvmStatic public external fun fixDifferentiatorParentTagForUnflattenCase(): Boolean
138138

139-
@DoNotStrip @JvmStatic public external fun fixFindShadowNodeByTagRaceCondition(): Boolean
140-
141139
@DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
142140

143141
@DoNotStrip @JvmStatic public external fun fixYogaFlexBasisFitContentInMainAxis(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<93e83fb3dc9577acd9678803321e0fe1>>
7+
* @generated SignedSource<<f63cf074bb6687c479e2f4059662ff76>>
88
*/
99

1010
/**
@@ -131,8 +131,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
131131

132132
override fun fixDifferentiatorParentTagForUnflattenCase(): Boolean = false
133133

134-
override fun fixFindShadowNodeByTagRaceCondition(): Boolean = false
135-
136134
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false
137135

138136
override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean = false

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<9d07e8adeee69583b788069649306d8e>>
7+
* @generated SignedSource<<27e88ec53841585796515db0406909dd>>
88
*/
99

1010
/**
@@ -78,7 +78,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
7878
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
7979
private var enableVirtualViewDebugFeaturesCache: Boolean? = null
8080
private var fixDifferentiatorParentTagForUnflattenCaseCache: Boolean? = null
81-
private var fixFindShadowNodeByTagRaceConditionCache: Boolean? = null
8281
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
8382
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
8483
private var fuseboxAssertSingleHostStateCache: Boolean? = null
@@ -657,16 +656,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
657656
return cached
658657
}
659658

660-
override fun fixFindShadowNodeByTagRaceCondition(): Boolean {
661-
var cached = fixFindShadowNodeByTagRaceConditionCache
662-
if (cached == null) {
663-
cached = currentProvider.fixFindShadowNodeByTagRaceCondition()
664-
accessedFeatureFlags.add("fixFindShadowNodeByTagRaceCondition")
665-
fixFindShadowNodeByTagRaceConditionCache = cached
666-
}
667-
return cached
668-
}
669-
670659
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean {
671660
var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache
672661
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<bcc599e04e3672d4bff293e267b3efa2>>
7+
* @generated SignedSource<<5670b927124074a4c59b692de8599cd5>>
88
*/
99

1010
/**
@@ -131,8 +131,6 @@ public interface ReactNativeFeatureFlagsProvider {
131131

132132
@DoNotStrip public fun fixDifferentiatorParentTagForUnflattenCase(): Boolean
133133

134-
@DoNotStrip public fun fixFindShadowNodeByTagRaceCondition(): Boolean
135-
136134
@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
137135

138136
@DoNotStrip public fun fixYogaFlexBasisFitContentInMainAxis(): Boolean

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<32c8c18771d6690f50d60dbc8e3d07e2>>
7+
* @generated SignedSource<<52bf46b50e91dacdac8d43c4c00ea6f3>>
88
*/
99

1010
/**
@@ -363,12 +363,6 @@ class ReactNativeFeatureFlagsJavaProvider
363363
return method(javaProvider_);
364364
}
365365

366-
bool fixFindShadowNodeByTagRaceCondition() override {
367-
static const auto method =
368-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixFindShadowNodeByTagRaceCondition");
369-
return method(javaProvider_);
370-
}
371-
372366
bool fixMappingOfEventPrioritiesBetweenFabricAndReact() override {
373367
static const auto method =
374368
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixMappingOfEventPrioritiesBetweenFabricAndReact");
@@ -865,11 +859,6 @@ bool JReactNativeFeatureFlagsCxxInterop::fixDifferentiatorParentTagForUnflattenC
865859
return ReactNativeFeatureFlags::fixDifferentiatorParentTagForUnflattenCase();
866860
}
867861

868-
bool JReactNativeFeatureFlagsCxxInterop::fixFindShadowNodeByTagRaceCondition(
869-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
870-
return ReactNativeFeatureFlags::fixFindShadowNodeByTagRaceCondition();
871-
}
872-
873862
bool JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact(
874863
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
875864
return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
@@ -1248,9 +1237,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
12481237
makeNativeMethod(
12491238
"fixDifferentiatorParentTagForUnflattenCase",
12501239
JReactNativeFeatureFlagsCxxInterop::fixDifferentiatorParentTagForUnflattenCase),
1251-
makeNativeMethod(
1252-
"fixFindShadowNodeByTagRaceCondition",
1253-
JReactNativeFeatureFlagsCxxInterop::fixFindShadowNodeByTagRaceCondition),
12541240
makeNativeMethod(
12551241
"fixMappingOfEventPrioritiesBetweenFabricAndReact",
12561242
JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact),

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<aacbc520b40625dbdba328590cc78112>>
7+
* @generated SignedSource<<f43b6cb2603f2c6dd2da415c4edc0a64>>
88
*/
99

1010
/**
@@ -192,9 +192,6 @@ class JReactNativeFeatureFlagsCxxInterop
192192
static bool fixDifferentiatorParentTagForUnflattenCase(
193193
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
194194

195-
static bool fixFindShadowNodeByTagRaceCondition(
196-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
197-
198195
static bool fixMappingOfEventPrioritiesBetweenFabricAndReact(
199196
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
200197

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<483ac339c0d636c85f4639c60982c504>>
7+
* @generated SignedSource<<19a0fa951fda8419542fe2fc376c40f9>>
88
*/
99

1010
/**
@@ -242,10 +242,6 @@ bool ReactNativeFeatureFlags::fixDifferentiatorParentTagForUnflattenCase() {
242242
return getAccessor().fixDifferentiatorParentTagForUnflattenCase();
243243
}
244244

245-
bool ReactNativeFeatureFlags::fixFindShadowNodeByTagRaceCondition() {
246-
return getAccessor().fixFindShadowNodeByTagRaceCondition();
247-
}
248-
249245
bool ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact() {
250246
return getAccessor().fixMappingOfEventPrioritiesBetweenFabricAndReact();
251247
}

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<771a335070649f38cb559a95d80947aa>>
7+
* @generated SignedSource<<f62617faffa739ee7822e44f3e5ff130>>
88
*/
99

1010
/**
@@ -309,11 +309,6 @@ class ReactNativeFeatureFlags {
309309
*/
310310
RN_EXPORT static bool fixDifferentiatorParentTagForUnflattenCase();
311311

312-
/**
313-
* Fix a use-after-free race condition in findShadowNodeByTag_DEPRECATED by using getCurrentRevision() instead of tryCommit() with a raw pointer.
314-
*/
315-
RN_EXPORT static bool fixFindShadowNodeByTagRaceCondition();
316-
317312
/**
318313
* Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
319314
*/

0 commit comments

Comments
 (0)