Skip to content

[Fiber] Fix infinite loop in scheduler and add more tests#8172

Merged
gaearon merged 4 commits intofacebook:masterfrom
gaearon:fiber-scheduling-tests-2
Nov 1, 2016
Merged

[Fiber] Fix infinite loop in scheduler and add more tests#8172
gaearon merged 4 commits intofacebook:masterfrom
gaearon:fiber-scheduling-tests-2

Conversation

@gaearon
Copy link
Copy Markdown
Collaborator

@gaearon gaearon commented Nov 1, 2016

Added a test that schedules roots in the reverse order compared to the previous time they were scheduled.

It hangs forever because we don't clear next pointer when unscheduling a root. Therefore, when it's scheduled again, it brings all its previous chain with it, potentially creating a cycle.

Fixed by clearing out the next pointer when unscheduling.

It hangs forever because we don't clear next pointer when unscheduling a root. Therefore, when it's scheduled again, it brings all its previous chain with it, potentially creating a cycle.
@gaearon
Copy link
Copy Markdown
Collaborator Author

gaearon commented Nov 1, 2016

Tests are passing. Something else at the end of test task fails travis.

Copy link
Copy Markdown
Contributor

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

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

Ok.

Btw I think we might maybe need to commit all the roots at once rather than one at a time as they complete. I'm not quite sure yet though.

return null;
}
nextScheduledRoot = nextScheduledRoot.nextScheduledRoot;
// Consider unscheduling next root.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what does this comment mean? Isn't that what you're doing above?

@sebmarkbage
Copy link
Copy Markdown
Contributor

You need to run the script tracking script.

Fixes a potential infinite cycle when we reschedule a root.
@gaearon gaearon force-pushed the fiber-scheduling-tests-2 branch from 2776ca8 to ccfa58b Compare November 1, 2016 17:42
@gaearon gaearon merged commit 1a49b5f into facebook:master Nov 1, 2016
acusti pushed a commit to brandcast/react that referenced this pull request Mar 15, 2017
)

* Make test more complete

* Add a failing test for scheduling in reverse order

It hangs forever because we don't clear next pointer when unscheduling a root. Therefore, when it's scheduled again, it brings all its previous chain with it, potentially creating a cycle.

* Clear the next pointer when unscheduling a root

Fixes a potential infinite cycle when we reschedule a root.

* Add new tests to Fiber test tracker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants