-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Enforced thread safety on UIImplementation methods that mutate the shadowNodeRegistry #20025
Conversation
|
I didn't change anything on iOS, not sure what's wrong with those tests :/ |
Those two tests are broken currently, don't bother yourself. |
I've found that your fix also resolves a couple of errors we're experiencing in production (react-native v0.47.1). Here's the list:
Big thumbs up, hope this will be merged soon. |
Fixes #20078 |
Can confirm that this PR fixes this exception we had with the native Android ViewPager in production (0.55.3): Fatal Exception: com.facebook.react.uimanager.IllegalViewOperationException |
Good. Let's hope to hear from someone in Facebook soon. |
Do you know which method is accessed from a different thread? I'd rather avoid locking by making sure calls are made from a single thread (unless we really have to). cc @mdvacca |
Anything that mutates the cssNode sparse array list is unsafe react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.java Line 20 in 5c2720b
|
really eager to see this merged! using react-native-navigation we see these crashes in production constantly, thanks so much for this! |
@SudoPlz I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
Hmm maybe @mkonicek can take a look? |
Any news on this? |
Hi everyone, we're also seeing many crashes on production caused by the mentioned issue(s) that this PR would fix, therefore we'd love to see this PR being reviewed and merged, so we don't have to (for the first time in 2 years) use a fork instead of the official RN version or add a custom UIImplementation handler as a workaround only to fix it. Since this PR didn't get much attention lately, maybe @sophiebits could take a look? |
same issues in my app on production :( |
@SudoPlz can you respond to my review comments? I was waiting on that before lobbying other contributors. FWIW, RN Windows has a similar fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the locks be finer-grained? It seems like there are more things in the synchronized() block than need to be.
ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java
Show resolved
Hide resolved
ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java
Show resolved
Hide resolved
Hey, any update on this? |
maybe its worth ask: @SudoPlz and @matthargett :-) |
I have no idea what the future of this PR is, the Facebook team is heavily working on Fabric right now, so I'd love their 2 cents on wether they'll be accepting this or not, or if they have another way of fixing it. |
By the way someone made a replication repo here https://github.com/Frank1234/RNViewPager I haven't tested it yet though. |
@matthargett , could you guys take this on please? Clearly the failed tests have nothing to do with @SudoPlz 's changes and this is causing production crashes for many users. Would be happy to help if there is anything I can do, but I suspect this is a bit out of my league. |
uhm the Detox fail doesn't seem to be related to this, I think I've seen it in other PRs too - I feel it may be something broken in master. |
Would you mind adding a test plan to your PR? |
@hramos not sure how to do that? Any examples? |
@SudoPlz you can check the label https://github.com/facebook/react-native/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc+label%3A%22%E2%9C%85Test+Plan%22, but basically it's at least a description of how to repro and how to ensure that there is a way to verify that the fix actually does the fix :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing that! ❤️
Could you please fix some nits?
- @mdvacca Should bless this before landing.
ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java
Show resolved
Hide resolved
ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java
Outdated
Show resolved
Hide resolved
Rebased, and removed the comments. |
Seeing crashes on my app as well related to this. Were these issues fixed somewhere else? Thanks! |
Oh wow, I'm sorry I missed this last time. Seems like it is outdated again. Would you mind rebasing it once more? Then I'll make sure we can get it reviewed and merged. |
…ode children sparse array - Fixes: facebook#17178 (comment)
@cpojer I've just rebased again, that should do the trick. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shergin is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This pull request was successfully merged by @SudoPlz in f149426. When will my fix make it into a release? | Upcoming Releases |
yaaaas! |
@cpojer We are on RN v 0.59 and we still getting this issue, have you verified the solution ? in which version it was merged? |
@mhdtouban based on the tags of the merge commit, it looks like it's only in 0.60 and later.
|
This was actually backported and released in v0.59.5: https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0595
|
Summary: Base sync before adding Flight files. This sync includes the following changes: - **[454c2211c](facebook/react@454c2211c )**: Refactor SchedulerHostConfigs ([#20025](facebook/react#20025)) //<Ricky>// - **[56e9feead](facebook/react@56e9feead )**: Remove Blocks ([#20138](facebook/react#20138)) //<Sebastian Markbåge>// - **[3fbd47b86](facebook/react@3fbd47b86 )**: Serialize pending server components by reference (lazy component) ([#20137](facebook/react#20137)) //<Sebastian Markbåge>// - **[930ce7c15](facebook/react@930ce7c15 )**: Allow values to be encoded by "reference" to a value rather than the value itself ([#20136](facebook/react#20136)) //<Sebastian Markbåge>// - **[39eb6d176](facebook/react@39eb6d176 )**: Rename ([#20134](facebook/react#20134)) //<Sebastian Markbåge>// - **[ffd842335](facebook/react@ffd842335 )**: [Flight] Add support for Module References in transport protocol ([#20121](facebook/react#20121)) //<Sebastian Markbåge>// - **[343d7a4a7](facebook/react@343d7a4a7 )**: Fast Refresh: Don't block DevTools commit hook ([#20129](facebook/react#20129)) //<Brian Vaughn>// - **[779a472b0](facebook/react@779a472b0 )**: Prevent inlining into recursive commit functions ([#20105](facebook/react#20105)) //<Andrew Clark>// - **[25b18d31c](facebook/react@25b18d31c )**: Traverse commit phase effects iteratively ([#20094](facebook/react#20094)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 4e5d7fa...454c221 Reviewed By: rickhanlonii Differential Revision: D24698701 fbshipit-source-id: dfaf692b1051150355dece1657764a484b7ae603
Hi, My environment is:
The error occurs occasionally on android device and emulator, while navigating from one screen to another in a stack navigator. Unfortunately, I cannot reproduce the error. Any idea?
|
We are also getting this error still in production only:
Not reproducible sadly. |
same here react-native 0.73.4
|
I do have the same issue on 0.72.7 |
Fixes: #17178
Changelog
[ANDROID] [Fixes] - UIImplementation: Now enforcing atomic mutation of the shadowNodeRegistry