-
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
[iOS] Crash in Value.cpp line 34 - facebook::react::Value::toJSONString(unsigned int) const #16099
Comments
Did any of ya'll come up with a workaround for this? We're seeing this error log pretty consistently in production, and users confirm it results in a crash, but we're not able to recreate it on our own. |
Any fix for this yet? |
has a workaround been found yet? |
+1 seeing the same behavior |
I’ve been seeing these occasionally, too. No idea what causes it. |
Has anyone found a fix for this yet? |
I get about a thousand of these daily. Could really use assistance in a work around or fix. The crash reports aren't helpful at identifying the cause. |
@facebook-github-bot label iOS |
+1 same error
One thing that's consistent: |
+1 same error Here are my package.json dependencies, if it helps: "dependencies": { |
I have it on these versions of iOS:
"dependencies": {
"bluebird": "~3.5.0",
"blueimp-md5": "^2.10.0",
"core-js": "^2.5.3",
"filepicker-js": "~2.4.17",
"final-form": "^3.0.0",
"fs": "https://github.com/cosmith/fs.git",
"lodash": "~4.17.4",
"lokijs": "~1.5.0",
"moment": "^2.19.1",
"node-polyglot": "~2.2.2",
"normalizr": "~3.2.3",
"pre-commit": "^1.2.2",
"raven-js": "^3.17.0",
"react": "16.0.0-alpha.12",
"react-final-form": "^2.1.0",
"react-native": "0.48.4",
"react-native-background-fetch": "^2.1.0",
"react-native-background-geolocation": "~2.9.3",
"react-native-check-box": "^2.0.1",
"react-native-code-push": "~5.1.1-beta",
"react-native-deprecated-custom-components": "^0.1.1",
"react-native-device-info": "~0.12.1",
"react-native-drawer": "~2.5.0",
"react-native-fabric": "~0.5.1",
"react-native-facebook-account-kit": "^0.9.0",
"react-native-fbsdk": "https://github.com/truckfly/react-native-fbsdk.git",
"react-native-fetch-blob": "~0.10.8",
"react-native-gifted-chat": "~0.2.7",
"react-native-image-picker": "~0.26.7",
"react-native-keep-awake": "^2.0.6",
"react-native-keyboard-aware-scroll-view": "~0.4.1",
"react-native-keyboard-spacer": "~0.4.1",
"react-native-localization": "~0.2.1",
"react-native-push-notification": "3.0.1",
"react-native-ux-cam": "~4.4.0",
"react-redux": "~5.0.6",
"redux": "~3.7.2",
"redux-logger": "~3.0.6",
"redux-raven-middleware": "^1.2.0",
"redux-thunk": "~2.2.0",
"whatwg-fetch": "^2.0.3"
} |
@pjktk2 Only common packages:
Though I am on 0.47.1 |
I'm also getting this in RN 0.52.0
|
@robwalkerco any progress? Are you able to replicate it? The stack trace isn't very helpful :/ |
@cosmith my finding were that the error happened when trying to store large json data to AsyncStorage on iOS. My example was a json string 52000000 characters long. I ended up getting around this issue by using realm as a storage engine for redux-persist, and also by splitting the reducer for that data into 16 separate reducers that are combined by a selector so I can easily use the data. I put the details in this answer in stack overflow - https://stackoverflow.com/a/48582319/3672622 |
@robwalkerco But I ain't using AsyncStorage :( |
@princenaman perhaps there is somewhere else in your code that’s transferring a large bit of data across the JavaScript bridge? That’s where I guess the crash is happening. Or perhaps some other package you are using that’s using AsyncStorage behind the scenes? |
The largest data that I am transferring is a JSON string about 5000 characters long. |
Thanks @robwalkerco. Did the crash always happen with your ~50Mb JSON string, or occasionally? Looking back at my crashes in production, some occurrences could have been coincident with writing 1-3Mb JSON strings to AsyncStorage, but (a) probably not all occurrences, (b) the app has likely written larger JSON strings a number of times without seeing this crash. Incidentally, my Crashlytics reports all put the available RAM at < 10% on these crashes. For an iPad 2 I think that's less than 50Mb free. Make a few copies of the string, maybe the memory usage report over-reported free memory...it's conceivable this is a memory problem. I'd love to test this hypothesis too, but RN doesn't have a hook for receiving low memory warnings though, right? |
@pjktk2 when I managed to replicate the crash (more by chance than anything) it was only happening when storing a large json string, and was happening consistently with that json (at least on my phone) I’ve not looked at memory availability, but will check our error reporting for any clues there. Sounds like you are well ahead of me in terms to tracking this bug down, so I will be interested to hear your findings! |
@pjktk2 I think your right about the memory issue. All the crashes happened when there was less than 5% RAM available on the device. |
This issue was introduced for us when upgrading from BatchedBridge to CxxBridge (react native's C++ bridge), which was made the default in react-native v0.45.0. We see thousands of crashes a day for about 6-7% of our users. I was able to replicate the crash by sending a large string (~100,000,000 characters long) to a custom NativeModule function that does nothing. The CxxBridge just isn't able to handle passing a string that large from JS to Native. It could be memory related, but doesn't happen when using BatchedBridge instead of CxxBridge. This definitely isn't limited to AsyncStorage, and could happen with any package or code that sends a large string across the bridge. If you're using redux-persist, persisting less data or blacklisting large reducers would fix the issue for now. Ideally the bridge would be able to handle larger strings... |
Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version? I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer. |
I’ll double check next week, but I was able to replicate this issue in the latest version of react native. It was introduced in react native v0.45.0. I think it would be better to keep this particular issue open as it has a lot of context. |
Just a follow up to @cosmith asking about reducing memory usage vis a vis workarounds: A few days ago I had a 100% reproducible case with this bug and I used the "opportunity" to clean up a bit of memory usage. I was storing a 6Mb string on a single AsyncStorage.setItem(). I profiled the app and found that memory usage spiked 8-10x that amount (i.e. 50-65Mb) when accessing that item. That spike was what caused the crash, every time. |
Hi @pjktk2, thanks for the followup. I was also able to make this crash disappear by saving the big blob of data that I had to the filesystem instead of AsyncStorage. |
I can reproduce this crash in my project 100%, every time I try to use 'console.tron.log'(the log helper of reactotron-react-native) to output the params of an event(like onBlur of TextInput),the app will crash after a few seconds without any response, maybe this is useful for locating the issue. "react-native": "0.54.1", |
@cosmith If you don't mind me asking, how did you achieve this? I'm serialising a 9MB object structure to JSON and writing it to disk with rn-fetch-blob, but it seems to crash quite often. |
I opened a new issue since the crash is still happening on the latest version of react-native. If anyone wants to chime in there, feel free :) |
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.5.0
Yarn: 1.0.1
npm: 5.3.0
Watchman: 4.6.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: 0.48.3 => 0.48.3
Target Platform: iOS
Crash
Hi, we're getting a crash on iOS in the internals of React Native. I haven't been able to reproduce, but you can find the Crashlytics stack trace here : http://crashes.to/s/d52d9bce313
Does anyone see the same crash?
The text was updated successfully, but these errors were encountered: