-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
[Fizz][Float] Do not write after closing the stream #27541
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Float methods can hang on to a reference to a Request after the request is closed due to AsyncLocalStorage. If a Float method is called at this point we do not want to attempt to flush anything. This change updates the closing logic to also call `stopFlowing` which will ensure that any checks against the destination properly reflect that we cannot do any writes. In addition it updates the enqueueFlush logic to existence check the destination inside the work function since it can change across the work scheduling gap if it is async.
facebook-github-bot
added
CLA Signed
React Core Team
Opened by a member of the React Core Team
labels
Oct 18, 2023
Comparing: 20c91b6...3b1f90d Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
sebmarkbage
approved these changes
Oct 18, 2023
github-actions bot
pushed a commit
that referenced
this pull request
Oct 18, 2023
Float methods can hang on to a reference to a Request after the request is closed due to AsyncLocalStorage. If a Float method is called at this point we do not want to attempt to flush anything. This change updates the closing logic to also call `stopFlowing` which will ensure that any checks against the destination properly reflect that we cannot do any writes. In addition it updates the enqueueFlush logic to existence check the destination inside the work function since it can change across the work scheduling gap if it is async. fixes: #27540 DiffTrain build for [601e5c3](601e5c3)
gnoff
added a commit
that referenced
this pull request
Oct 18, 2023
In #27541 I added tests to assert that the write after close bug was fixed. However the Node implementation has an abort behavior preventing reproduction of the original issue and the Browser build does not use AsyncLocalStorage which also prevents reproduction. This change moves the Browser test to a Edge runtime where AsyncLocalStorage is polyfilled. In this implementation the test does correctly fail when the patch is removed.
gnoff
added a commit
to gnoff/next.js
that referenced
this pull request
Oct 18, 2023
gnoff
added a commit
to gnoff/next.js
that referenced
this pull request
Oct 18, 2023
gnoff
added a commit
to gnoff/next.js
that referenced
this pull request
Oct 20, 2023
EdisonVan
pushed a commit
to EdisonVan/react
that referenced
this pull request
Apr 15, 2024
Float methods can hang on to a reference to a Request after the request is closed due to AsyncLocalStorage. If a Float method is called at this point we do not want to attempt to flush anything. This change updates the closing logic to also call `stopFlowing` which will ensure that any checks against the destination properly reflect that we cannot do any writes. In addition it updates the enqueueFlush logic to existence check the destination inside the work function since it can change across the work scheduling gap if it is async. fixes: facebook#27540
EdisonVan
pushed a commit
to EdisonVan/react
that referenced
this pull request
Apr 15, 2024
In facebook#27541 I added tests to assert that the write after close bug was fixed. However the Node implementation has an abort behavior preventing reproduction of the original issue and the Browser build does not use AsyncLocalStorage which also prevents reproduction. This change moves the Browser test to a Edge runtime where AsyncLocalStorage is polyfilled. In this implementation the test does correctly fail when the patch is removed.
bigfootjon
pushed a commit
that referenced
this pull request
Apr 18, 2024
Float methods can hang on to a reference to a Request after the request is closed due to AsyncLocalStorage. If a Float method is called at this point we do not want to attempt to flush anything. This change updates the closing logic to also call `stopFlowing` which will ensure that any checks against the destination properly reflect that we cannot do any writes. In addition it updates the enqueueFlush logic to existence check the destination inside the work function since it can change across the work scheduling gap if it is async. fixes: #27540 DiffTrain build for commit 601e5c3.
Hm, this is not fixed, react version 18.3.1 |
It won't be part of the 18.x release line but React 19. You can try it out in the React release candidate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Float methods can hang on to a reference to a Request after the request is closed due to AsyncLocalStorage. If a Float method is called at this point we do not want to attempt to flush anything. This change updates the closing logic to also call
stopFlowing
which will ensure that any checks against the destination properly reflect that we cannot do any writes. In addition it updates the enqueueFlush logic to existence check the destination inside the work function since it can change across the work scheduling gap if it is async.fixes: #27540