-
Notifications
You must be signed in to change notification settings - Fork 24.1k
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
Release underlying resources when JS instance is GC'ed on Android try 2 #26155
Release underlying resources when JS instance is GC'ed on Android try 2 #26155
Conversation
cc @makovkastar |
RNTester/android/app/BUCK
Outdated
@@ -25,6 +25,7 @@ rn_android_library( | |||
react_native_target("java/com/facebook/react:react"), | |||
react_native_target("java/com/facebook/react/common:build_config"), | |||
react_native_target("java/com/facebook/react/modules/core:core"), | |||
react_native_target("java/com/facebook/react/views/text:text"), |
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.
Why was this dependency introduced?
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.
I reverted 983ba63 to start this pr so it came from that. I’m not sure why it was it was added in the original commit. Should I just remove it?
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.
Yeah, let's remove it if it's not needed.
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.
Fixed
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.
@makovkastar has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
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.
@makovkastar has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@janicduplessis I've imported this PR, but it failed to compile when I tried to build with Buck: stderr: xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.cpp:22: error: undefined reference to 'facebook::jsi::HostObject::~HostObject()' Could you please take a look? |
@makovkastar I'm not able to reproduce the issue with the OSS buck setup, could you investigate this one? I did some tweaks to the buck file but I can't tell if it will fix the issue. |
The text addition in the buck file was actually fixing the buck build for RN tester, there are quite a fe w more things that need to be fixed for the oss buck build of RN tester to work so I will open a separate PR for that. |
@makovkastar Any change you can have a look at this again? |
Hi @janicduplessis, I've been busy lately with some Fabric work and didn't have time to look into it. I will try to check it this evening, but no promises. |
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.
@makovkastar has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
I made a small change in the BUCK file and it's building now. I'm waiting for the code review from one of the teams that was affected last time we landed this PR. If everything is OK, I will merge it on Monday. |
Will this be backported to 0.60? This was a huge issue on our app and has caused a lot of lost engineering resources for us.. This merges with relatively little merge conflicts on 0.60-stable, see https://github.com/mcuelenaere/react-native/tree/backport/android-blob-gc-0.60 |
Any idea how soon can we get this? We have been waiting for this one for a long time. Will be great if someone can look at the broken tests so this can go in? |
This PR was accepted and now there are some internal tests being run before merging this. I will try to get this merged today. |
This pull request was successfully merged by @janicduplessis in 9b2374b. When will my fix make it into a release? | Upcoming Releases |
Thanks @makovkastar and @janicduplessis for resolving this. Looking forward to having this in the upcoming release. Any idea when that might be? |
@Talha-Ahmed I'll try to get it cherry-picked in the next 0.60.x release |
… 2 (facebook#26155) Summary: Reland facebook#24767 The commit had to be reverted because it caused a crash when using remote debugging in chrome. This is normal since jsi is not available in that environment. The crash was caused by `jsContext.get()` being 0, then being dereferenced later in c++. We can simply skip initializing the blob collector in this case. This also includes the fix from facebook#25720 to fix a crash when using hermes. [Android] [Fixed] - Release underlying resources when JS instance is GC'ed on Android Pull Request resolved: facebook#26155 Test Plan: Test using RN tester with jsc and hermes Test remote debugging Reviewed By: mdvacca, fred2028 Differential Revision: D17072644 Pulled By: makovkastar fbshipit-source-id: 079d1d43501e854297fbbe586ba229920c892584
To people who are interested in this, we are keeping track of these changes at https://github.com/getdelta/react-native/tree/0.60-patched (prebuilt Android binaries are available at https://github.com/getdelta/react-native/tree/0.60-patched-prebuilt) |
This didn't get picked in 0.60.6. Can this please be released soon? @janicduplessis @makovkastar |
… 2 (#26155) Summary: Reland #24767 The commit had to be reverted because it caused a crash when using remote debugging in chrome. This is normal since jsi is not available in that environment. The crash was caused by `jsContext.get()` being 0, then being dereferenced later in c++. We can simply skip initializing the blob collector in this case. This also includes the fix from #25720 to fix a crash when using hermes. ## Changelog [Android] [Fixed] - Release underlying resources when JS instance is GC'ed on Android Pull Request resolved: #26155 Test Plan: Test using RN tester with jsc and hermes Test remote debugging Reviewed By: mdvacca, fred2028 Differential Revision: D17072644 Pulled By: makovkastar fbshipit-source-id: 079d1d43501e854297fbbe586ba229920c892584
… 2 (#26155) Summary: Reland facebook/react-native#24767 The commit had to be reverted because it caused a crash when using remote debugging in chrome. This is normal since jsi is not available in that environment. The crash was caused by `jsContext.get()` being 0, then being dereferenced later in c++. We can simply skip initializing the blob collector in this case. This also includes the fix from facebook/react-native#25720 to fix a crash when using hermes. ## Changelog [Android] [Fixed] - Release underlying resources when JS instance is GC'ed on Android Pull Request resolved: facebook/react-native#26155 Test Plan: Test using RN tester with jsc and hermes Test remote debugging Reviewed By: mdvacca, fred2028 Differential Revision: D17072644 Pulled By: makovkastar fbshipit-source-id: 079d1d43501e854297fbbe586ba229920c892584
Summary
Reland #24767
The commit had to be reverted because it caused a crash when using remote debugging in chrome. This is normal since jsi is not available in that environment. The crash was caused by
jsContext.get()
being 0, then being dereferenced later in c++. We can simply skip initializing the blob collector in this case.This also includes the fix from #25720 to fix a crash when using hermes.
Changelog
[Android] [Fixed] - Release underlying resources when JS instance is GC'ed on Android
Test Plan
Test using RN tester with jsc and hermes
Test remote debugging