Skip to content

Commit b0c5930

Browse files
committed
[Flight] Ignore bound-anonymous-fn resources as they're not considered I/O (#34911)
When you create a snapshot from an AsyncLocalStorage in Node.js, that creates a new bound AsyncResource which everything runs inside of. https://github.com/nodejs/node/blob/3437e1c4bd529e51d96ea581b6435bbeb77ef524/lib/internal/async_local_storage/async_hooks.js#L61-L67 This resource is itself tracked by our async debug tracking as I/O. We can't really distinguish these in general from other AsyncResources which are I/O. However, by default they're given the name `"bound-anonymous-fn"` if you pass it an anonymous function or in the case of a snapshot, that's built-in: https://github.com/nodejs/node/blob/3437e1c4bd529e51d96ea581b6435bbeb77ef524/lib/async_hooks.js#L262-L263 We can at least assume that these are non-I/O. If you want to ensure that a bound resource is not considered I/O, you can ensure your function isn't assigned a name or give it this explicit name. The other issue here is that, the sequencing here is that we track the callsite of the `.snapshot()` or `.bind()` call as the trigger. So if that was outside of render for example, then it would be considered non-I/O. However, this might miss stuff if you resolve promises inside the `.run()` of the snapshot if the `.run()` call itself was spawned by I/O which should be tracked. Time will tell if those patterns appear. However, in cases like nested renders (e.g. Next.js's "use cache") then restoring it as if it was outside the parent render is what you do want. DiffTrain build for [58bdc0b](58bdc0b)
1 parent b94afbf commit b0c5930

34 files changed

+86
-86
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ec7d9a7249e84e841fbe1e4c22e1be2c0c15dae4
1+
58bdc0bb967098f14562cd76af0668f2056459a0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ec7d9a7249e84e841fbe1e4c22e1be2c0c15dae4
1+
58bdc0bb967098f14562cd76af0668f2056459a0

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ __DEV__ &&
14991499
exports.useTransition = function () {
15001500
return resolveDispatcher().useTransition();
15011501
};
1502-
exports.version = "19.3.0-www-classic-ec7d9a72-20251019";
1502+
exports.version = "19.3.0-www-classic-58bdc0bb-20251019";
15031503
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15041504
"function" ===
15051505
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ __DEV__ &&
14991499
exports.useTransition = function () {
15001500
return resolveDispatcher().useTransition();
15011501
};
1502-
exports.version = "19.3.0-www-modern-ec7d9a72-20251019";
1502+
exports.version = "19.3.0-www-modern-58bdc0bb-20251019";
15031503
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15041504
"function" ===
15051505
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,4 +606,4 @@ exports.useSyncExternalStore = function (
606606
exports.useTransition = function () {
607607
return ReactSharedInternals.H.useTransition();
608608
};
609-
exports.version = "19.3.0-www-classic-ec7d9a72-20251019";
609+
exports.version = "19.3.0-www-classic-58bdc0bb-20251019";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,4 +606,4 @@ exports.useSyncExternalStore = function (
606606
exports.useTransition = function () {
607607
return ReactSharedInternals.H.useTransition();
608608
};
609-
exports.version = "19.3.0-www-modern-ec7d9a72-20251019";
609+
exports.version = "19.3.0-www-modern-58bdc0bb-20251019";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.3.0-www-classic-ec7d9a72-20251019";
613+
exports.version = "19.3.0-www-classic-58bdc0bb-20251019";
614614
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
615615
"function" ===
616616
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.3.0-www-modern-ec7d9a72-20251019";
613+
exports.version = "19.3.0-www-modern-58bdc0bb-20251019";
614614
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
615615
"function" ===
616616
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20371,10 +20371,10 @@ __DEV__ &&
2037120371
(function () {
2037220372
var internals = {
2037320373
bundleType: 1,
20374-
version: "19.3.0-www-classic-ec7d9a72-20251019",
20374+
version: "19.3.0-www-classic-58bdc0bb-20251019",
2037520375
rendererPackageName: "react-art",
2037620376
currentDispatcherRef: ReactSharedInternals,
20377-
reconcilerVersion: "19.3.0-www-classic-ec7d9a72-20251019"
20377+
reconcilerVersion: "19.3.0-www-classic-58bdc0bb-20251019"
2037820378
};
2037920379
internals.overrideHookState = overrideHookState;
2038020380
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -20409,7 +20409,7 @@ __DEV__ &&
2040920409
exports.Shape = Shape;
2041020410
exports.Surface = Surface;
2041120411
exports.Text = Text;
20412-
exports.version = "19.3.0-www-classic-ec7d9a72-20251019";
20412+
exports.version = "19.3.0-www-classic-58bdc0bb-20251019";
2041320413
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2041420414
"function" ===
2041520415
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20142,10 +20142,10 @@ __DEV__ &&
2014220142
(function () {
2014320143
var internals = {
2014420144
bundleType: 1,
20145-
version: "19.3.0-www-modern-ec7d9a72-20251019",
20145+
version: "19.3.0-www-modern-58bdc0bb-20251019",
2014620146
rendererPackageName: "react-art",
2014720147
currentDispatcherRef: ReactSharedInternals,
20148-
reconcilerVersion: "19.3.0-www-modern-ec7d9a72-20251019"
20148+
reconcilerVersion: "19.3.0-www-modern-58bdc0bb-20251019"
2014920149
};
2015020150
internals.overrideHookState = overrideHookState;
2015120151
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -20180,7 +20180,7 @@ __DEV__ &&
2018020180
exports.Shape = Shape;
2018120181
exports.Surface = Surface;
2018220182
exports.Text = Text;
20183-
exports.version = "19.3.0-www-modern-ec7d9a72-20251019";
20183+
exports.version = "19.3.0-www-modern-58bdc0bb-20251019";
2018420184
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2018520185
"function" ===
2018620186
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)