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

Fix continuation bug #31434

Merged
merged 6 commits into from
Nov 11, 2024
Merged

Conversation

rickhanlonii
Copy link
Member

Overview

In scheduleTaskForRootDuringMicrotask we clear root.callbackNode if the work loop is suspended waiting on data.

But we don't null check root.callbackNode before returning a continuation in performWorkOnRootViaSchedulerTask where scheduleTaskForRootDuringMicrotask is synchronously called, causing an infinite loop when the only thing in the queue is something suspended waiting on data.

This essentially restores the behavior from here: https://github.com/facebook/react/pull/26328/files#diff-72ff2175ae3569037f0b16802a41b0cda2b2d66bb97f2bda78ed8445ed487b58L1168

Found by investigating the failures for #31417

TODO

  • add a test

Copy link

vercel bot commented Nov 5, 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 Nov 11, 2024 9:58pm

@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Nov 5, 2024
@react-sizebot
Copy link

react-sizebot commented Nov 5, 2024

The size diff is too large to display in a single comment. The GitHub action for this pull request contains an artifact called 'sizebot-message.md' with the full message.

Generated by 🚫 dangerJS against 4696b45

@rickhanlonii rickhanlonii merged commit b836de6 into facebook:main Nov 11, 2024
184 checks passed
@rickhanlonii rickhanlonii deleted the rh/continuation-bug branch November 11, 2024 22:25
github-actions bot pushed a commit that referenced this pull request Nov 11, 2024
## Overview

In `scheduleTaskForRootDuringMicrotask` we clear `root.callbackNode` if
the work loop is [suspended waiting on
data](https://github.com/facebook/react/blob/ac3ca097aeecae8fe3ec7f9b286307a923676518/packages/react-reconciler/src/ReactFiberRootScheduler.js#L338).

But we don't null check `root.callbackNode` before returning a
continuation in `performWorkOnRootViaSchedulerTask` where
`scheduleTaskForRootDuringMicrotask` is synchronously called, causing an
infinite loop when the only thing in the queue is something suspended
waiting on data.

This essentially restores the behavior from here:
https://github.com/facebook/react/pull/26328/files#diff-72ff2175ae3569037f0b16802a41b0cda2b2d66bb97f2bda78ed8445ed487b58L1168

Found by investigating the failures for
#31417

## TODO
- add a test

---------

Co-authored-by: Joe Savona <[email protected]>

DiffTrain build for [b836de6](b836de6)
github-actions bot pushed a commit that referenced this pull request Nov 11, 2024
## Overview

In `scheduleTaskForRootDuringMicrotask` we clear `root.callbackNode` if
the work loop is [suspended waiting on
data](https://github.com/facebook/react/blob/ac3ca097aeecae8fe3ec7f9b286307a923676518/packages/react-reconciler/src/ReactFiberRootScheduler.js#L338).

But we don't null check `root.callbackNode` before returning a
continuation in `performWorkOnRootViaSchedulerTask` where
`scheduleTaskForRootDuringMicrotask` is synchronously called, causing an
infinite loop when the only thing in the queue is something suspended
waiting on data.

This essentially restores the behavior from here:
https://github.com/facebook/react/pull/26328/files#diff-72ff2175ae3569037f0b16802a41b0cda2b2d66bb97f2bda78ed8445ed487b58L1168

Found by investigating the failures for
#31417

## TODO
- add a test

---------

Co-authored-by: Joe Savona <[email protected]>

DiffTrain build for [b836de6](b836de6)
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.

5 participants