-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[0.54.0][Android] Crash in ReadableNativeArray.getType when size of ReadableNativeArray > 512 #18292
Comments
Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest stable release? Thank you for your contributions. |
I check the code in 0.55.0 and latest master branch, the problem remains. You can find the code analysis here, and reproduce the crash in this project |
My first reaction when I read the issue is that this is something the chart library would need to address, but on further review it looks like you were able to isolate the issue and reproduce it without using the third party library. Would you consider rewriting the issue a bit to fill out the repro steps more clearly? For example, expecting "render chart with more than 512 points" could be interpreted as something that is not the core library's concern. It would help community members understand the issue at a glance before deciding to dive in. Thanks! |
I updated the issue a little bit to make it more clear. |
Any progress? |
Waiting for an update regarding this issue. |
can be a temporary workaround. |
@wuxudong, thanks for suggesting a workaround. Where in your project are you setting?
|
I think xxApplication is a good place for it.
|
@wuxudong Actually adding those two lines crashes the app. I actually moved to react-native-charts-wrapper to better performance/zooming so stopping at 512 elements is a deal breaker.. -- edit -- Those lines stopped crashing the app when I also pasted this there:
|
I am also running into this issue, but I see it when using react-native-sqlite-storage to insert large amounts of data. We can work around by decreasing the batch size of data we import, but it causes performance issues for our use case.
|
@wuxudong's workaround seems to prevent this issue, we put the |
is there any new progress? I have also encountered this issue. version 0.54.3 |
any news on this? |
@hramos, this is a pretty standard JNI problem. I think the problem in the methods below - you are trying to return an array of local references there I think this might trigger the limit check. Try to pass big enough data chunk through the bridge and it will choke.
One possible solution is to convert the refs to globals before putting to array and release the local refs. There is a 64k limit for global references as well. Unlikely somebody will pass such a big data structure, but everything is possible. Some modules transfer DB responses using NativeMap and NativeArray. Another solution is to chunk the data from native for these methods. I hope you measuring this carefully. The whole Arrays/Maps rework looks like a big landmine to me now, I glad you leave a way to turn it off. Once it will be fixed appropriately the performance gain should be re-evaluated ... |
I think I found the problem. to release it reset should be called. Will publish PR with the fix soon :) |
Summary: release method of local_ref and global_ref doesn't call deallocator, in fact, it leaves the caller responsible for deletion of the reference, while otherwise the reference is released on scope left. Fixes facebook#18292. Pull Request resolved: facebook#20913 Differential Revision: D9616237 Pulled By: hramos fbshipit-source-id: 021aa3e4f039e6b7a98da3e4224c1ee49d5a4921
RN0.57.5 will be solved |
Summary: release method of local_ref and global_ref doesn't call deallocator, in fact, it leaves the caller responsible for deletion of the reference, while otherwise the reference is released on scope left. Fixes #18292. Pull Request resolved: #20913 Differential Revision: D9616237 Pulled By: hramos fbshipit-source-id: 021aa3e4f039e6b7a98da3e4224c1ee49d5a4921
Summary: release method of local_ref and global_ref doesn't call deallocator, in fact, it leaves the caller responsible for deletion of the reference, while otherwise the reference is released on scope left. Fixes facebook#18292. Pull Request resolved: facebook#20913 Differential Revision: D9616237 Pulled By: hramos fbshipit-source-id: 021aa3e4f039e6b7a98da3e4224c1ee49d5a4921
In project react-native-chart-wrapper#229, It works well in react-native 0.53.0, but will crash in react-native 0.54.0 when data points are more than 512 in android platform.
On further review, I found the crash is related to jni function ReadableNativeArray.getType(index).
In react-native 0.53.0, ReadableNativeArray.getType(index) will only care the type at the index,
but in react-native 0.54.0, ReadableNativeArray.getType(index) will get type of every element in the array, then return the type at index, but crash if array.size > 512.
Environment
Environment:
OS: macOS High Sierra 10.13.3
Node: 9.3.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react: 16.1.1 => 16.1.1
react-native: 0.54.0 => 0.54.0
Expected Behavior
ReadableNativeArray.getType(index) can return element type at index when ReadableNativeArray.size > 512
Actual Behavior
It crash. Log is listed below.
Steps to Reproduce
I create a simplified project to reproduce the crash without using any third party library.
The main code is listed below.
DummyManager.java
Types.js
App.js
If array size in App.js = 500, it works well, and will crash if array size > 512.
It works well in react-native 0.53.0
The text was updated successfully, but these errors were encountered: