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] Don't call onError/onPostpone when halting and unify error branches #31715

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

sebmarkbage
Copy link
Collaborator

We shouldn't call onError/onPostpone when we halt a stream because that node didn't error yet. Its digest would also get lost.

We also have a lot of error branches now for thenables and streams. This unifies them under erroredTask. I'm not yet unifying the cases that don't allocate a task for the error when those are outlined.

@sebmarkbage sebmarkbage requested a review from gnoff December 10, 2024 04:40
Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 4:41am

@react-sizebot
Copy link

Comparing: 372ec00...c4a7dd1

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.js = 6.68 kB 6.68 kB = 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 510.81 kB 510.81 kB = 91.43 kB 91.43 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 515.74 kB 515.74 kB = 92.14 kB 92.14 kB
facebook-www/ReactDOM-prod.classic.js = 595.67 kB 595.67 kB = 105.14 kB 105.14 kB
facebook-www/ReactDOM-prod.modern.js = 585.93 kB 585.93 kB = 103.57 kB 103.57 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js = 102.94 kB 100.75 kB = 20.76 kB 20.59 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js = 102.88 kB 100.69 kB = 20.74 kB 20.52 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js = 101.89 kB 99.70 kB = 20.47 kB 20.30 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js = 99.93 kB 97.73 kB = 20.08 kB 19.93 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js = 99.86 kB 97.67 kB = 20.07 kB 19.91 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js = 99.83 kB 97.63 kB = 20.06 kB 19.90 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js = 99.41 kB 97.22 kB = 19.90 kB 19.74 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 158.97 kB 155.40 kB = 29.02 kB 28.73 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js = 158.91 kB 155.33 kB = 29.01 kB 28.72 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 157.77 kB 154.19 kB = 28.72 kB 28.41 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 157.27 kB 153.70 kB = 28.50 kB 28.20 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js = 157.20 kB 153.63 kB = 28.49 kB 28.19 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js = 95.91 kB 93.72 kB = 19.51 kB 19.35 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 154.60 kB 151.02 kB = 28.12 kB 27.86 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js = 154.05 kB 150.48 kB = 28.00 kB 27.73 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js = 151.08 kB 147.50 kB = 27.62 kB 27.35 kB
oss-experimental/react-server/cjs/react-server-flight.development.js = 108.56 kB 104.98 kB = 19.54 kB 19.31 kB
oss-experimental/react-server/cjs/react-server-flight.production.js = 64.70 kB 62.40 kB = 12.56 kB 12.40 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 142.08 kB 141.14 kB = 26.37 kB 26.31 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 142.08 kB 141.14 kB = 26.37 kB 26.31 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 142.08 kB 141.14 kB = 26.37 kB 26.31 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js = 142.01 kB 141.07 kB = 26.36 kB 26.30 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js = 142.01 kB 141.07 kB = 26.36 kB 26.30 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js = 142.01 kB 141.07 kB = 26.36 kB 26.30 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 140.87 kB 139.93 kB = 26.07 kB 26.01 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 140.87 kB 139.93 kB = 26.07 kB 26.01 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 140.87 kB 139.93 kB = 26.07 kB 26.01 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 139.59 kB 138.65 kB = 25.98 kB 25.91 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 139.59 kB 138.65 kB = 25.98 kB 25.91 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 139.59 kB 138.65 kB = 25.98 kB 25.91 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js = 139.52 kB 138.57 kB = 25.97 kB 25.89 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js = 139.52 kB 138.57 kB = 25.97 kB 25.89 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js = 139.52 kB 138.57 kB = 25.97 kB 25.89 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 138.61 kB 137.66 kB = 25.82 kB 25.75 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 138.61 kB 137.66 kB = 25.82 kB 25.75 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 138.61 kB 137.66 kB = 25.82 kB 25.75 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js = 138.06 kB 137.12 kB = 25.69 kB 25.63 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js = 138.06 kB 137.12 kB = 25.69 kB 25.63 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js = 138.06 kB 137.12 kB = 25.69 kB 25.63 kB
oss-experimental/react-markup/cjs/react-markup.react-server.development.js = 513.66 kB 510.10 kB = 91.89 kB 91.63 kB
oss-experimental/react-markup/cjs/react-markup.react-server.production.js = 308.81 kB 306.66 kB = 57.78 kB 57.62 kB
oss-stable-rc/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js = 134.17 kB 133.23 kB = 25.05 kB 24.98 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js = 134.17 kB 133.23 kB = 25.05 kB 24.98 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js = 134.17 kB 133.23 kB = 25.05 kB 24.98 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js = 95.82 kB 95.04 kB = 19.61 kB 19.58 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js = 95.82 kB 95.04 kB = 19.61 kB 19.58 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js = 95.82 kB 95.04 kB = 19.61 kB 19.58 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js = 95.75 kB 94.97 kB = 19.59 kB 19.56 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js = 95.75 kB 94.97 kB = 19.59 kB 19.56 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js = 95.75 kB 94.97 kB = 19.59 kB 19.56 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js = 94.77 kB 93.98 kB = 19.39 kB 19.36 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js = 94.77 kB 93.98 kB = 19.39 kB 19.36 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js = 94.77 kB 93.98 kB = 19.39 kB 19.36 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js = 92.70 kB 91.92 kB = 19.05 kB 19.01 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js = 92.70 kB 91.92 kB = 19.05 kB 19.01 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js = 92.70 kB 91.92 kB = 19.05 kB 19.01 kB
oss-stable-rc/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js = 92.68 kB 91.90 kB = 19.03 kB 19.00 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js = 92.68 kB 91.90 kB = 19.03 kB 19.00 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js = 92.68 kB 91.90 kB = 19.03 kB 19.00 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js = 92.63 kB 91.84 kB = 19.03 kB 19.00 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js = 92.63 kB 91.84 kB = 19.03 kB 19.00 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js = 92.63 kB 91.84 kB = 19.03 kB 19.00 kB
oss-stable-rc/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js = 92.26 kB 91.48 kB = 18.93 kB 18.89 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js = 92.26 kB 91.48 kB = 18.93 kB 18.89 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js = 92.26 kB 91.48 kB = 18.93 kB 18.89 kB
oss-stable-rc/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js = 88.78 kB 88.00 kB = 18.45 kB 18.40 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js = 88.78 kB 88.00 kB = 18.45 kB 18.40 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js = 88.78 kB 88.00 kB = 18.45 kB 18.40 kB
oss-stable-rc/react-server/cjs/react-server-flight.development.js = 94.17 kB 93.24 kB = 17.31 kB 17.25 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js = 94.17 kB 93.24 kB = 17.31 kB 17.25 kB
oss-stable/react-server/cjs/react-server-flight.development.js = 94.17 kB 93.24 kB = 17.31 kB 17.25 kB
oss-stable-rc/react-server/cjs/react-server-flight.production.js = 58.46 kB 57.63 kB = 11.62 kB 11.60 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.js = 58.46 kB 57.63 kB = 11.62 kB 11.60 kB
oss-stable/react-server/cjs/react-server-flight.production.js = 58.46 kB 57.63 kB = 11.62 kB 11.60 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js = 102.94 kB 100.75 kB = 20.76 kB 20.59 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js = 102.88 kB 100.69 kB = 20.74 kB 20.52 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js = 101.89 kB 99.70 kB = 20.47 kB 20.30 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js = 99.93 kB 97.73 kB = 20.08 kB 19.93 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js = 99.86 kB 97.67 kB = 20.07 kB 19.91 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js = 99.83 kB 97.63 kB = 20.06 kB 19.90 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js = 99.41 kB 97.22 kB = 19.90 kB 19.74 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js = 158.97 kB 155.40 kB = 29.02 kB 28.73 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js = 158.91 kB 155.33 kB = 29.01 kB 28.72 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js = 157.77 kB 154.19 kB = 28.72 kB 28.41 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js = 157.27 kB 153.70 kB = 28.50 kB 28.20 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js = 157.20 kB 153.63 kB = 28.49 kB 28.19 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js = 95.91 kB 93.72 kB = 19.51 kB 19.35 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js = 154.60 kB 151.02 kB = 28.12 kB 27.86 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js = 154.05 kB 150.48 kB = 28.00 kB 27.73 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js = 151.08 kB 147.50 kB = 27.62 kB 27.35 kB
oss-experimental/react-server/cjs/react-server-flight.development.js = 108.56 kB 104.98 kB = 19.54 kB 19.31 kB
oss-experimental/react-server/cjs/react-server-flight.production.js = 64.70 kB 62.40 kB = 12.56 kB 12.40 kB

Generated by 🚫 dangerJS against e67eacd

@sebmarkbage sebmarkbage merged commit 4a8fc0f into facebook:main Dec 10, 2024
184 checks passed
github-actions bot pushed a commit to code/lib-react that referenced this pull request Dec 10, 2024
…ranches (facebook#31715)

We shouldn't call onError/onPostpone when we halt a stream because that
node didn't error yet. Its digest would also get lost.

We also have a lot of error branches now for thenables and streams. This
unifies them under erroredTask. I'm not yet unifying the cases that
don't allocate a task for the error when those are outlined.

DiffTrain build for [4a8fc0f](facebook@4a8fc0f)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Dec 10, 2024
…ranches (facebook#31715)

We shouldn't call onError/onPostpone when we halt a stream because that
node didn't error yet. Its digest would also get lost.

We also have a lot of error branches now for thenables and streams. This
unifies them under erroredTask. I'm not yet unifying the cases that
don't allocate a task for the error when those are outlined.

DiffTrain build for [4a8fc0f](facebook@4a8fc0f)
gnoff added a commit to vercel/next.js that referenced this pull request Dec 10, 2024
…ic (#73751)

Instead of relying on onError just use the timing of the prerender
resolution to determine whether the server render completed before
aborting.

React is going to remove onError and onPostpone calls from `prerender`
in flight [31715](facebook/react#31715). This is
because semantically the error is going to be hidden from the prerender
and on resume it might not error. So rather than relying on whether the
error callback is called we simply infer whether we are done by checking
if the `prerender` resolved prior to our abort deadline. In our case it
is possible we also aborted earlier than the deadline because you can
call something like `Math.random()` which requires the `prerender` to
halt synchronously so we also check the signal status in our deadline
task.

We don't expect this to change any semantics so there are no altered
tests.

This is only currently implemented in the dynamicIO + PPR case because
that is the only case using experimental React with `prerender`. When
dynamicIO is on by itself we still use `renderToReadableStream` which
does not have halt semantics. We will switch to `prerender` when it is
available in React's stable channel
sebmarkbage added a commit that referenced this pull request Dec 11, 2024
Stacked on #31715.

This adds profiling data for Server Components to the RSC stream (but
doesn't yet use it for anything). This is on behind
`enableProfilerTimer` which is on for Dev and Profiling builds. However,
for now there's no Profiling build of Flight so in practice only in DEV.
It's gated on `enableComponentPerformanceTrack` which is experimental
only for now.

We first emit a timeOrigin in the beginning of the stream. This provides
us a relative time to emit timestamps against for cross environment
transfer so that we can log it in terms of absolute times. Using this as
a separate field allows the actual relative timestamps to be a bit more
compact representation and preserves floating point precision.

We emit a timestamp before emitting a Server Component which represents
the start time of the Server Component. The end time is either when the
next Server Component starts or when we finish the task.

We omit the end time for simple tasks that are outlined without Server
Components.

By encoding this as part of the debugInfo stream, this information can
be forwarded between Server to Server RSC.
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