Skip to content

Commit c7cf3e0

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Silence assert triggered by background executor race condition (#40895)
Summary: Pull Request resolved: #40895 This is a long running debug assert due to a race condition with BE. I have at times wanted to try to add a lock to protect this, and measure impact, but really it will go away when we get rid of BE anyway, and any strategy I have come up with to lock gets hairy quickly. This change does not impact RN in OSS, where BE is already disabled. Changelog: [Internal] Reviewed By: rshest Differential Revision: D50247680 fbshipit-source-id: d004fc7db24f1f0b7c3ea8756d4678ce41579712
1 parent 3bea8e1 commit c7cf3e0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,20 @@ YogaLayoutableShadowNode::YogaLayoutableShadowNode(
106106
yogaConfig_(FabricDefaultYogaLog),
107107
yogaNode_(static_cast<const YogaLayoutableShadowNode&>(sourceShadowNode)
108108
.yogaNode_) {
109-
// Note, cloned `yoga::Node` instance (copied using copy-constructor) inherits
110-
// dirty flag, measure function, and other properties being set originally in
111-
// the `YogaLayoutableShadowNode` constructor above.
112-
109+
// Note, cloned `yoga::Node` instance (copied using copy-constructor) inherits
110+
// dirty flag, measure function, and other properties being set originally in
111+
// the `YogaLayoutableShadowNode` constructor above.
112+
113+
// There is a known race condition when background executor is enabled, where
114+
// a tree may be laid out on the Fabric background thread concurrently with
115+
// the ShadowTree being created on the JS thread. This assert can be
116+
// re-enabled after disabling background executor everywhere.
117+
#if 0
113118
react_native_assert(
114119
static_cast<const YogaLayoutableShadowNode&>(sourceShadowNode)
115120
.yogaNode_.isDirty() == yogaNode_.isDirty() &&
116121
"Yoga node must inherit dirty flag.");
122+
#endif
117123

118124
if (!getTraits().check(ShadowNodeTraits::Trait::LeafYogaNode)) {
119125
for (auto& child : getChildren()) {

0 commit comments

Comments
 (0)