Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flight] Wire up async_hooks in Node.js DEV for inspecting Promises #27840

Merged
merged 4 commits into from
Dec 16, 2023

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Dec 15, 2023

This wires up the use of async_hooks in the Node build (as well as the Edge build when a global is available) in DEV mode only. This will be used to track debug info about what suspended during an RSC pass.

Enabled behind a flag for now.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Dec 15, 2023
@react-sizebot
Copy link

react-sizebot commented Dec 15, 2023

Comparing: 493610f...52c924e

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 175.90 kB 175.90 kB = 54.76 kB 54.75 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 177.97 kB 177.97 kB = 55.39 kB 55.39 kB
facebook-www/ReactDOM-prod.classic.js = 570.21 kB 570.21 kB = 100.35 kB 100.35 kB
facebook-www/ReactDOM-prod.modern.js = 554.06 kB 554.06 kB = 97.43 kB 97.43 kB
test_utils/ReactAllWarnings.js Deleted 67.41 kB 0.00 kB Deleted 16.49 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.83% 115.85 kB 116.82 kB +1.26% 27.47 kB 27.81 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.82% 117.92 kB 118.88 kB +1.26% 28.03 kB 28.38 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.min.js +0.68% 26.70 kB 26.88 kB +0.56% 9.06 kB 9.11 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.min.js +0.68% 26.70 kB 26.88 kB +0.56% 9.06 kB 9.11 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +0.67% 27.33 kB 27.51 kB +0.54% 9.21 kB 9.26 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +0.67% 27.33 kB 27.51 kB +0.54% 9.21 kB 9.26 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.min.js +0.61% 29.87 kB 30.06 kB +0.53% 9.92 kB 9.97 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +0.60% 30.51 kB 30.69 kB +0.49% 10.07 kB 10.12 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.58% 112.72 kB 113.37 kB +0.87% 26.32 kB 26.55 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.55% 118.13 kB 118.78 kB +0.81% 27.54 kB 27.76 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.54% 120.55 kB 121.20 kB +0.80% 28.18 kB 28.40 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.54% 120.77 kB 121.42 kB +0.79% 28.39 kB 28.61 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.53% 123.19 kB 123.84 kB +0.77% 29.06 kB 29.29 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +0.29% 92.75 kB 93.02 kB +0.38% 22.23 kB 22.31 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +0.29% 92.75 kB 93.02 kB +0.38% 22.23 kB 22.31 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +0.29% 94.81 kB 95.08 kB +0.39% 22.79 kB 22.88 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +0.29% 94.81 kB 95.08 kB +0.39% 22.79 kB 22.88 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.29% 102.45 kB 102.74 kB +0.33% 24.56 kB 24.65 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.29% 102.45 kB 102.74 kB +0.33% 24.56 kB 24.65 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.28% 104.51 kB 104.80 kB +0.34% 25.12 kB 25.20 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.28% 104.51 kB 104.80 kB +0.34% 25.12 kB 25.20 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +0.26% 104.03 kB 104.31 kB +0.33% 24.56 kB 24.65 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +0.26% 106.09 kB 106.36 kB +0.35% 25.14 kB 25.23 kB
oss-experimental/react-is/umd/react-is.development.js = 7.95 kB 7.91 kB = 2.11 kB 2.09 kB
oss-stable-semver/react-is/umd/react-is.development.js = 7.93 kB 7.88 kB = 2.10 kB 2.08 kB
oss-stable/react-is/umd/react-is.development.js = 7.93 kB 7.88 kB = 2.10 kB 2.08 kB
oss-experimental/react-is/cjs/react-is.development.js = 7.35 kB 7.31 kB = 2.01 kB 1.99 kB
oss-stable-semver/react-is/cjs/react-is.development.js = 7.33 kB 7.28 kB = 2.01 kB 1.99 kB
oss-stable/react-is/cjs/react-is.development.js = 7.33 kB 7.28 kB = 2.01 kB 1.99 kB
oss-experimental/react-is/cjs/react-is.production.js = 6.62 kB 6.58 kB = 1.80 kB 1.78 kB
oss-stable-semver/react-is/cjs/react-is.production.js = 6.60 kB 6.55 kB = 1.79 kB 1.77 kB
oss-stable/react-is/cjs/react-is.production.js = 6.60 kB 6.55 kB = 1.79 kB 1.77 kB
test_utils/ReactAllWarnings.js Deleted 67.41 kB 0.00 kB Deleted 16.49 kB 0.00 kB

Generated by 🚫 dangerJS against 52c924e

In the Edge build we currently get this from the global object just like
AsyncLocalStorage. This is unfortunate and something we'd like to move away
from.
This is a DEV only feature.
@sebmarkbage sebmarkbage changed the title [Flight] Wire up async [Flight] Wire up async_hooks in Node.js DEV for inspecting Promises Dec 15, 2023
@@ -117,6 +118,8 @@ import binaryToComparableString from 'shared/binaryToComparableString';

import {SuspenseException, getSuspendedThenable} from './ReactFlightThenable';

initAsyncDebugInfo();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explicit init here is really only due to the module cycle between the implementation and the config since we need createAsyncHook to have been resolved already.

@sebmarkbage
Copy link
Collaborator Author

Diagnostic Channels were evaluated but they're not detailed enough to trace where something was eventually awaited and what ultimately caused what. It just tells you that it happened.

@sebmarkbage sebmarkbage merged commit 8b8d265 into facebook:main Dec 16, 2023
36 checks passed
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
…acebook#27840)

This wires up the use of `async_hooks` in the Node build (as well as the
Edge build when a global is available) in DEV mode only. This will be
used to track debug info about what suspended during an RSC pass.

Enabled behind a flag for now.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
…27840)

This wires up the use of `async_hooks` in the Node build (as well as the
Edge build when a global is available) in DEV mode only. This will be
used to track debug info about what suspended during an RSC pass.

Enabled behind a flag for now.

DiffTrain build for commit 8b8d265.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants