react-native
react-native copied to clipboard
Possible race condition in RuntimeScheduler.cpp
Description
I may be wrong, and I don't know if any special guarantees can be made regarding how threads interact with the scheduler, but the following code appears to me to be a race condition:
https://github.com/facebook/react-native/blob/17d2a27ff8d76e894f7bf6f59e1ccb8657aaca57/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp#L128-L136
It is possible for two threads to read isWorkLoopScheduled_ and isPerformingWork_ as false and enter the branch.
Version
Output of npx react-native info
Steps to reproduce
Snack, code example, screenshot, or link to a repository
No response
and I don't know if any special guarantees can be made regarding how threads interact with the scheduler, but the following code appears to me to be a race condition
Is this causing a problem? Are you able to create a reproducer for it or you're just raising this from reading the code?
Just from reading the code. I figured I'd raise the issue in case it was unintentional - This seems to be the sort of thing that's almost always a bug or at least deserving of an explanatory comment.
We are using GitHub issues exclusively to track bugs in React Native. GitHub may not be the ideal place to ask a question, but you can try asking over on Stack Overflow, or on Reactiflux.
Sorry the closure was unintentional.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
While this issue has gone stale, it is probably still worth triaging
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.