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

Include regular stack trace in serialized errors from Fizz #28684

Merged
merged 3 commits into from
Mar 30, 2024

Conversation

sebmarkbage
Copy link
Collaborator

We previously only included the component stack.

Cleaned up the fields in Fizz server that wasn't using consistent hidden classes in dev vs prod.

Added a prefix to errors serialized from server rendering. It can be a bit confusing to see where this error came from otherwise since it didn't come from elsewhere on the client. It's really kind of confusing with other recoverable errors that happen on the client too.

We previously only included the component stack.

Also cleaned up the fields in Fizz server that wasn't using consistent
hidden classes in dev vs prod.
escapeTextForBrowser loops over individual characters on a string and
stacks can be quite large to encode.
@sebmarkbage sebmarkbage requested a review from gnoff March 29, 2024 22:51
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Mar 29, 2024
@react-sizebot
Copy link

react-sizebot commented Mar 29, 2024

Comparing: cc56bed...e4d2591

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 = 176.42 kB 176.43 kB +0.02% 54.85 kB 54.86 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 172.85 kB 172.86 kB +0.01% 53.89 kB 53.90 kB
facebook-www/ReactDOM-prod.classic.js = 592.03 kB 592.06 kB = 103.86 kB 103.86 kB
facebook-www/ReactDOM-prod.modern.js = 574.21 kB 574.24 kB = 100.92 kB 100.93 kB
test_utils/ReactAllWarnings.js Deleted 64.70 kB 0.00 kB Deleted 16.16 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-dom/unstable_server-external-runtime.js +0.75% 3.32 kB 3.35 kB +0.94% 1.49 kB 1.50 kB
oss-stable-semver/react-dom/unstable_server-external-runtime.js +0.75% 3.32 kB 3.35 kB +0.94% 1.49 kB 1.50 kB
oss-stable/react-dom/unstable_server-external-runtime.js +0.75% 3.32 kB 3.35 kB +0.94% 1.49 kB 1.50 kB
facebook-www/ReactDOMServer-dev.modern.js +0.33% 493.01 kB 494.63 kB +0.19% 100.43 kB 100.62 kB
facebook-www/ReactDOMServer-dev.classic.js +0.33% 495.67 kB 497.30 kB +0.19% 100.91 kB 101.10 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js +0.33% 486.06 kB 487.65 kB +0.19% 98.82 kB 99.00 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.22% 421.23 kB 422.16 kB +0.14% 95.08 kB 95.21 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.22% 421.25 kB 422.18 kB +0.14% 95.11 kB 95.24 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js +0.22% 422.95 kB 423.88 kB +0.14% 95.52 kB 95.65 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js +0.22% 422.97 kB 423.90 kB +0.14% 95.54 kB 95.68 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js +0.22% 414.92 kB 415.83 kB +0.14% 93.16 kB 93.29 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js +0.22% 414.94 kB 415.85 kB +0.14% 93.18 kB 93.31 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.development.js +0.22% 441.01 kB 441.97 kB +0.16% 96.06 kB 96.21 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.development.js +0.22% 441.03 kB 441.99 kB +0.16% 96.08 kB 96.23 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js +0.22% 419.48 kB 420.39 kB +0.17% 94.05 kB 94.20 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js +0.22% 419.51 kB 420.42 kB +0.17% 94.07 kB 94.23 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js +0.22% 420.58 kB 421.49 kB +0.14% 95.17 kB 95.31 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js +0.22% 420.61 kB 421.51 kB +0.14% 95.20 kB 95.33 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js +0.22% 421.17 kB 422.07 kB +0.13% 95.31 kB 95.43 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js +0.22% 421.19 kB 422.10 kB +0.13% 95.33 kB 95.46 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.js +0.21% 320.26 kB 320.94 kB +0.13% 70.54 kB 70.64 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.js +0.21% 320.28 kB 320.97 kB +0.13% 70.57 kB 70.66 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.21% 435.09 kB 436.02 kB +0.14% 97.47 kB 97.61 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js +0.21% 436.81 kB 437.74 kB +0.14% 97.91 kB 98.04 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.js +0.21% 322.83 kB 323.52 kB +0.12% 70.56 kB 70.65 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.js +0.21% 322.86 kB 323.55 kB +0.12% 70.59 kB 70.68 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.development.js +0.21% 440.35 kB 441.29 kB +0.15% 96.15 kB 96.29 kB
oss-stable/react-dom/umd/react-dom-server.browser.development.js +0.21% 440.38 kB 441.31 kB +0.15% 96.17 kB 96.32 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.js +0.21% 324.46 kB 325.15 kB +0.12% 71.84 kB 71.93 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.js +0.21% 324.48 kB 325.17 kB +0.12% 71.87 kB 71.95 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.development.js +0.21% 428.78 kB 429.69 kB +0.13% 95.57 kB 95.70 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.development.js +0.21% 455.44 kB 456.40 kB +0.17% 98.47 kB 98.64 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js +0.21% 442.12 kB 443.03 kB +0.13% 97.77 kB 97.89 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.js +0.20% 320.64 kB 321.30 kB +0.13% 70.35 kB 70.45 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.js +0.20% 320.67 kB 321.33 kB +0.13% 70.38 kB 70.47 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js +0.20% 443.75 kB 444.66 kB +0.13% 98.58 kB 98.71 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js +0.20% 444.34 kB 445.24 kB +0.13% 98.71 kB 98.84 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.js +0.20% 318.45 kB 319.09 kB +0.12% 69.74 kB 69.82 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.js +0.20% 318.47 kB 319.12 kB +0.11% 69.77 kB 69.85 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.js +0.20% 341.66 kB 342.34 kB +0.12% 73.36 kB 73.45 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.js +0.20% 326.35 kB 327.01 kB +0.12% 72.07 kB 72.16 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.js +0.20% 326.38 kB 327.03 kB +0.11% 72.10 kB 72.18 kB
oss-experimental/react-dom/umd/react-dom-server.browser.development.js +0.20% 464.50 kB 465.44 kB +0.14% 99.53 kB 99.67 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js = 89.09 kB 88.86 kB = 27.20 kB 27.15 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js = 83.22 kB 82.99 kB = 25.27 kB 25.21 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js = 85.64 kB 85.40 kB = 26.35 kB 26.30 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js = 85.61 kB 85.38 kB = 26.33 kB 26.28 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js = 83.30 kB 83.07 kB = 25.63 kB 25.59 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js = 80.14 kB 79.90 kB = 24.46 kB 24.42 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js = 80.11 kB 79.87 kB = 24.44 kB 24.40 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js = 80.22 kB 79.97 kB = 24.82 kB 24.77 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js = 80.19 kB 79.95 kB = 24.80 kB 24.75 kB
facebook-www/ReactDOMServer-prod.classic.js = 206.58 kB 205.57 kB = 37.55 kB 37.47 kB
facebook-www/ReactDOMServer-prod.modern.js = 205.02 kB 204.02 kB = 37.24 kB 37.16 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js = 208.97 kB 207.94 kB = 38.60 kB 38.51 kB
test_utils/ReactAllWarnings.js Deleted 64.70 kB 0.00 kB Deleted 16.16 kB 0.00 kB

Generated by 🚫 dangerJS against e4d2591

@sebmarkbage sebmarkbage force-pushed the servererror branch 2 times, most recently from 4255c4e to cebf8e1 Compare March 29, 2024 22:57
It can be a bit confusing to see where this error came from otherwise
since it didn't come from elsewhere on the client.
@@ -13,7 +13,7 @@
// This should be reasonable for all loops in the source.
// Note that if the numbers are too large, the tests will take too long to fail
// for this to be useful (each individual test case might hit an infinite loop).
const MAX_SOURCE_ITERATIONS = 1500;
const MAX_SOURCE_ITERATIONS = 5000;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did you have to bump this?

Copy link
Collaborator Author

@sebmarkbage sebmarkbage Mar 30, 2024

Choose a reason for hiding this comment

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

It's in the commit comment but escapeTextForBrowser is a tight loop for escaping and it easily gets up there with escaping stack traces. It's not even deterministic in our tests since it depends on your local file system what stack gets generated and how long it is.

We should probably find a way to disable this for hot loops.

@sebmarkbage sebmarkbage merged commit b9149cc into facebook:main Mar 30, 2024
38 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 30, 2024
We previously only included the component stack.

Cleaned up the fields in Fizz server that wasn't using consistent hidden
classes in dev vs prod.

Added a prefix to errors serialized from server rendering. It can be a
bit confusing to see where this error came from otherwise since it
didn't come from elsewhere on the client. It's really kind of confusing
with other recoverable errors that happen on the client too.

DiffTrain build for [b9149cc](b9149cc)
sebmarkbage added a commit that referenced this pull request Apr 4, 2024
Follow up to #28684.

V8 includes the message in the stack and printed errors include just the
stack property which is assumed to contain the message. Without this,
the prefix doesn't get printed in the console.

<img width="578" alt="Screenshot 2024-04-03 at 6 32 04 PM"
src="https://github.com/facebook/react/assets/63648/d98a2db4-6ebc-4805-b669-59f449dfd21f">

A possible alternative would be to use a nested error with a `cause`
like #28736 but that would need some more involved serializing since
this prefix is coming from the server. Perhaps as a separate attribute.
github-actions bot pushed a commit that referenced this pull request Apr 4, 2024
Follow up to #28684.

V8 includes the message in the stack and printed errors include just the
stack property which is assumed to contain the message. Without this,
the prefix doesn't get printed in the console.

<img width="578" alt="Screenshot 2024-04-03 at 6 32 04 PM"
src="https://github.com/facebook/react/assets/63648/d98a2db4-6ebc-4805-b669-59f449dfd21f">

A possible alternative would be to use a nested error with a `cause`
like #28736 but that would need some more involved serializing since
this prefix is coming from the server. Perhaps as a separate attribute.

DiffTrain build for [583eb67](583eb67)
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
…28684)

We previously only included the component stack.
    
Cleaned up the fields in Fizz server that wasn't using consistent hidden
classes in dev vs prod.

Added a prefix to errors serialized from server rendering. It can be a
bit confusing to see where this error came from otherwise since it
didn't come from elsewhere on the client. It's really kind of confusing
with other recoverable errors that happen on the client too.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
Follow up to facebook#28684.

V8 includes the message in the stack and printed errors include just the
stack property which is assumed to contain the message. Without this,
the prefix doesn't get printed in the console.

<img width="578" alt="Screenshot 2024-04-03 at 6 32 04 PM"
src="https://github.com/facebook/react/assets/63648/d98a2db4-6ebc-4805-b669-59f449dfd21f">

A possible alternative would be to use a nested error with a `cause`
like facebook#28736 but that would need some more involved serializing since
this prefix is coming from the server. Perhaps as a separate attribute.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
We previously only included the component stack.

Cleaned up the fields in Fizz server that wasn't using consistent hidden
classes in dev vs prod.

Added a prefix to errors serialized from server rendering. It can be a
bit confusing to see where this error came from otherwise since it
didn't come from elsewhere on the client. It's really kind of confusing
with other recoverable errors that happen on the client too.

DiffTrain build for commit b9149cc.
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