-
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
[Regression] [0.57] Fetching images on iOS fails with an empty fetch body and warning that "Received data was not a string, or was not a recognized encoding." #21092
Comments
I saw that fetch (whatwg-fetch) calls Changing I don't know if this is related to whatwg-fetch or ios code |
…22063) Summary: This is a problem that is discussed in issue #21092 Related issues: #21851 #19717 Found the code to eventually fix this issue [here](https://github.com/github/fetch/blob/899b155746630c32d83ee29a38642da16b314ecb/fetch.js#L486) - [x] Fetching an image locally and check if the blob is there, as well as its size > 0. ___ Help reviewers and the release process by writing your own release notes. See below for an example. [GENERAL] [ENHANCEMENT] [whatwg-fetch] - set blob as default XMLHttpRequest header response type if supported Pull Request resolved: #22063 Differential Revision: D13408797 Pulled By: cpojer fbshipit-source-id: 9822d5a7e24bacd72838f3fc9a61b1a97b44484b
…acebook#22063) Summary: This is a problem that is discussed in issue facebook#21092 Related issues: facebook#21851 facebook#19717 Found the code to eventually fix this issue [here](https://github.com/github/fetch/blob/899b155746630c32d83ee29a38642da16b314ecb/fetch.js#L486) - [x] Fetching an image locally and check if the blob is there, as well as its size > 0. ___ Help reviewers and the release process by writing your own release notes. See below for an example. [GENERAL] [ENHANCEMENT] [whatwg-fetch] - set blob as default XMLHttpRequest header response type if supported Pull Request resolved: facebook#22063 Differential Revision: D13408797 Pulled By: cpojer fbshipit-source-id: 9822d5a7e24bacd72838f3fc9a61b1a97b44484b
@Gregoirevda Oh god, you just saved my day. I was using fetch(), rn-fetch-blob with no luck for an entire day. Thanks a lot. |
Summary: Our Blob implementation was very problematic because it didn't release its underlying resource when the JS instance was dealocated. The main issue is that the fetch polyfill uses blobs by default if the module is available, which causes large memory leaks. This fixes it by using the new jsi infra to attach a `jsi::HostObject` (`BlobCollector`) to `Blob` instances. This way when the `Blob` is collected, the `BlobCollector` also gets collected. Using the `jsi::HostObject` dtor we can schedule the cleanup of native resources. This is definitely not the ideal solution but otherwise it would require rewriting the whole module using TurboModules + jsi. Fixes #23801, #20352, #21092 [General] [Fixed] - [Blob] Release underlying resources when JS instance in GC'ed Pull Request resolved: #24405 Differential Revision: D15237418 Pulled By: cpojer fbshipit-source-id: 00a94a54b0b172fbc62324364b753d192ac7016a
Summary: Our Blob implementation was very problematic because it didn't release its underlying resource when the JS instance was dealocated. The main issue is that the fetch polyfill uses blobs by default if the module is available, which causes large memory leaks. This fixes it by using the new jsi infra to attach a `jsi::HostObject` (`BlobCollector`) to `Blob` instances. This way when the `Blob` is collected, the `BlobCollector` also gets collected. Using the `jsi::HostObject` dtor we can schedule the cleanup of native resources. This is definitely not the ideal solution but otherwise it would require rewriting the whole module using TurboModules + jsi. Fixes #23801, #20352, #21092 [General] [Fixed] - [Blob] Release underlying resources when JS instance in GC'ed Pull Request resolved: #24745 Reviewed By: fkgozali Differential Revision: D15248848 Pulled By: hramos fbshipit-source-id: 1da835cc935dfbf4e7bb6fbf2aea29bfdc9bd6fa
Environment
Description
Trying to
fetch
an image on iOS errors out with "Received data was not a string, or was not a recognized encoding." The body of the fetch response is empty:Output from debug console for iOS:
This works absolutely fine on Android.
Output from debug console on Android:
This is definitely a regression since this worked absolutely on fine on iOS on the 0.55 release (the same version that's currently used by Expo as of 13th September 2018 -- 0.55.4 to be precise). Blobs should be fetch-able since 0.54: (https://github.com/facebook/react-native/releases/tag/v0.54.0)
Reproducible Demo
react-native init
a new app, and paste this inApp.js
:Also tried with this direct file URL: https://i.imgur.com/w45SLoD.jpg
The text was updated successfully, but these errors were encountered: