react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Possible race condition in RuntimeScheduler.cpp

Open jeremy-rifkin opened this issue 3 years ago • 6 comments
trafficstars

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

jeremy-rifkin avatar Apr 23 '22 20:04 jeremy-rifkin

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?

cortinico avatar May 06 '22 19:05 cortinico

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.

jeremy-rifkin avatar May 06 '22 19:05 jeremy-rifkin

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.

github-actions[bot] avatar May 10 '22 12:05 github-actions[bot]

Sorry the closure was unintentional.

cortinico avatar May 10 '22 12:05 cortinico

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.

github-actions[bot] avatar Nov 07 '22 02:11 github-actions[bot]

While this issue has gone stale, it is probably still worth triaging

jeremy-rifkin avatar Nov 07 '22 02:11 jeremy-rifkin

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.

github-actions[bot] avatar Mar 06 '24 05:03 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Mar 13 '24 05:03 github-actions[bot]