-
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
"Property storage exceeds 196607 properties" error when using fetch
more than a certain number of times in React Native
#39441
Comments
I also added PR #39528 |
Summary: issue: #39441 For the following reasons, I have replaced an object used for id management inside BlobRegistry with `Map`. - The polyfill used for `fetch`, [whatwg-fetch](https://github.com/JakeChampion/fetch), returns responses as `Blob` objects. - When a `Blob` is created, it is registered with blobID in the [BlobRegistry](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Blob/BlobRegistry.js), which is not automatically released. - This issue was previously reported in #19248 and was fixed by modifying whatwg-fetch. However, with the implementation of automatic garbage collection in #24405, the implementation was reverted in commit bccc92d, returning to the original behavior. - Although #24405 enables `Blob` objects to be garbage collected, the Blob IDs registered in the BlobRegistry remain, causing the count to increase each time `fetch` is called. - As a result, the `Property storage exceeds 196607 properties` error occurs To address this issue, I have modified the implementation of `BlobRegistry` to use a `Map` instead of an object. By using a `Map`, there is no limit to the number of entries. ## Changelog: [Internal] - [Fixed] - Fixed a bug that caused a "Property storage exceeds 196607 properties" error when sending a certain number of `fetch` requests. Pull Request resolved: #39528 Test Plan: I've added a new tests in `packages/react-native/Libraries/Blob/__tests__/BlobRegistry-test.js` and confirmed the test pass before and after changes. ``` $ yarn run test ... Test Suites: 1 skipped, 219 passed, 219 of 220 total Tests: 2 skipped, 4017 passed, 4019 total Snapshots: 1154 passed, 1154 total Time: 10.525 s Ran all test suites. ✨ Done in 12.52s. ``` Reviewed By: javache Differential Revision: D49423213 Pulled By: NickGerleman fbshipit-source-id: d5f73d7f5e34d1d2c3969b7dfbc45d3e6196aa30
Summary: issue: facebook#39441 For the following reasons, I have replaced an object used for id management inside BlobRegistry with `Map`. - The polyfill used for `fetch`, [whatwg-fetch](https://github.com/JakeChampion/fetch), returns responses as `Blob` objects. - When a `Blob` is created, it is registered with blobID in the [BlobRegistry](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Blob/BlobRegistry.js), which is not automatically released. - This issue was previously reported in facebook#19248 and was fixed by modifying whatwg-fetch. However, with the implementation of automatic garbage collection in facebook#24405, the implementation was reverted in commit bccc92d, returning to the original behavior. - Although facebook#24405 enables `Blob` objects to be garbage collected, the Blob IDs registered in the BlobRegistry remain, causing the count to increase each time `fetch` is called. - As a result, the `Property storage exceeds 196607 properties` error occurs To address this issue, I have modified the implementation of `BlobRegistry` to use a `Map` instead of an object. By using a `Map`, there is no limit to the number of entries. ## Changelog: [Internal] - [Fixed] - Fixed a bug that caused a "Property storage exceeds 196607 properties" error when sending a certain number of `fetch` requests. Pull Request resolved: facebook#39528 Test Plan: I've added a new tests in `packages/react-native/Libraries/Blob/__tests__/BlobRegistry-test.js` and confirmed the test pass before and after changes. ``` $ yarn run test ... Test Suites: 1 skipped, 219 passed, 219 of 220 total Tests: 2 skipped, 4017 passed, 4019 total Snapshots: 1154 passed, 1154 total Time: 10.525 s Ran all test suites. ✨ Done in 12.52s. ``` Reviewed By: javache Differential Revision: D49423213 Pulled By: NickGerleman fbshipit-source-id: d5f73d7f5e34d1d2c3969b7dfbc45d3e6196aa30
Will this be in release 0.72.4 and beyond? ... I have the same issue. |
getting same issue too |
Is this rolled back to react-native .71.2? If so, does anybody know how to pick it up on vscode? I am already using react-native tools which seems to be using react-native .71.2.... I can't find instructions to pick up patches or upgrade react native within vscode. |
Do you guys know which version it is fixed? I am using 0.72.6 and getting this error. |
Above they gave a thumbs up to .72.4 so I assume from that point on... I upgraded to .73 and have not seen it.... although I have not tried to recreate it. |
Can anyone tell what this is regards to? which module is throwing this error? no clue, can't debug. |
Can anyone confirm what version this is fixed on? Or even that it really is fixed? |
I have the same problem with 0.72.10 |
Facing the same issue with 0.73.1. Data from the server contains buffer data which might be the reason for this error. |
0.73.4 still with error here |
@ishikawa are you sure this is fixed and should be closed? |
Observing the same issue on long running app in 0.72.6. |
@ishikawa would you please re-open this issue? |
This! Observed with 72.6 and higher. |
facebook/hermes#851 may be related |
@tribou yes I think so. Good find. |
I'm facing the same issue on Android. |
Same Issue here 0.73.1 in a long running app. Issue needs re-opening please! RangeError: Property storage exceeds 196607 properties
|
Facing the same issue on 0.74.1 with Hermes. |
Facing the same issue when trying to upload file to aws s3 (even if I think it's not related to file-upload action, seems to be related to the |
Facing the same issue, any updates on this? I also have a image upload, and somethimes after being a couple of minutes afk in the app i get this error Property storage exceeds 196607 properties |
Has the problem been solved? |
Still facing this problem in 0.73.0 |
What can be the cause of this error? |
I believe the cause is that objects can only support a maximum of 196607 properties in the Hermes engine |
I get this error when the simulator is open and I let it sit idle for a bit. |
For me I |
Thank you, you've saved me a headache |
Can you show details of this implementation/fix? What do you mean? |
Console logging on an extremely large array causes the error / crash. Which makes sense. |
I used |
Same problem in react-native 0.74.5 |
Same problem in React Native v0.75.2 |
Hi @ishikawa, I see that several users, including myself, are still facing this issue in the latest versions. Would you consider reopening this issue to raise awareness and revisit the problem? Thank you! |
also experiencing the same thing |
I'm experiencing the same thing too |
experiencing the same thing |
Apologies for the delay in responding. Since the fix I proposed was merged, I have not been able to reproduce the issue when using I also updated my previous reproduction code to the latest Expo SDK 51 (w/ react-native 0.74.5), but the issue still does not reproduce. While I don’t have much capacity to dive deeper into this, if anyone is seeing this issue with |
I'm using tanstack query to do a get requisition from 5 to 5s, after 6h (maybe), emit this error. 0.73.6. I'm using axios with react query |
React native: function App() {
useEffect(() => {
const tenMb = new Uint8Array(10 * 1024 * 1024);
const formData = new FormData();
formData.append("0", tenMb);
fetch("https://www.google.com/", {
method: "POST",
body: formData
})
.then(res => {
console.log("successfully send 10mb", res);
})
.catch(err => {
console.log("failed to send 10mb", err);
});
}, []);
return null
This is because Uint8Array is not converted to Blob. If convert - it works |
any news on how to fix this? |
This does not seem to be exclusively related to fetch. |
this is my exact experience, started a new build and for now it is gone. |
same for me
|
I think people are not understanding this is related to the maximum properties an object can have. Make an enormous array and log it out and you'll face this problem too. |
I dont have any case like that. |
Yes, that may be true. The problem is that the identity of the hypothetical enormous array is a mistery.
|
Description
We are developing an application using React Native and Expo. This application needs to run 24/7 and performs network requests using
fetch()
regularly for monitoring purposes.The issue we are facing is that after running the application for a while, from some point, network requests starting to fail. Through investigation using logs from Sentry, we have identified the following problem:
fetch()
for network requests.fetch()
request, an error occurs:Property storage exceeds 196607 properties
.The stack trace when this error occurs is as follows:
Through further investigation, the following findings have been uncovered:
fetch
, whatwg-fetch, returns responses asBlob
objects.Blob
is created, it is registered with blobID in the BlobRegistry, which is not automatically released.Blob
objects to be garbage collected, the Blob IDs registered in the BlobRegistry remain, causing the count to increase each timefetch
is called.Property storage exceeds 196607 properties
error occursOur solution
To address this issue and prevent the error, we have modified the implementation of
BlobRegistry
to use aMap
instead of an object. By using a Map, there is no limit to the number of entries.React Native Version
0.72.4
Output of
npx react-native info
System:
OS: macOS 13.4.1
CPU: (8) arm64 Apple M2
Memory: 92.86 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.17.0
path: /usr/local/bin/node
Yarn:
version: 1.22.19
path: /usr/local/bin/yarn
npm:
version: 9.6.7
path: /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.12.1
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.4
- iOS 16.4
- macOS 13.3
- tvOS 16.4
- watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8815526
Xcode:
version: 14.3/14E222b
path: /usr/bin/xcodebuild
Languages:
Java: Not Found
Ruby:
version: 3.2.2
path: /Users/takanori.ishikawa/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.4
wanted: 0.72.4
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Steps to reproduce
Invoke
fetch()
more than 196,607 times 😄Snack, screenshot, or link to a repository
To demonstrate this issue, I created a simple Expo application.
https://github.com/ishikawa/react-native-fetch-property-storage-exceeds-error
You can run it with expo:
The text was updated successfully, but these errors were encountered: