-
Notifications
You must be signed in to change notification settings - Fork 69
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
Error "Malformed calls from JS: field sizes are different" (caused by "Cannot freeze") occurs on 0.60.5 #27
Comments
This is the diff we're using in our react-native fork: diff --git a/Libraries/BatchedBridge/MessageQueue.js b/Libraries/BatchedBridge/MessageQueue.js
index 8fce2a7e67..afbf514103 100644
--- a/Libraries/BatchedBridge/MessageQueue.js
+++ b/Libraries/BatchedBridge/MessageQueue.js
@@ -284,8 +284,14 @@ class MessageQueue {
JSON.stringify(params, replacer),
);
- // The params object should not be mutated after being queued
- deepFreezeAndThrowOnMutationInDev((params: any));
+ try {
+ // The params object should not be mutated after being queued
+ deepFreezeAndThrowOnMutationInDev((params: any));
+ } catch (err) {
+ // This is not a blocking issue, show a warning but continue executing
+ // (see https://github.com/Kudo/react-native-v8/issues/27 for more context)
+ console.warn('Cannot freeze: ' + JSON.stringify(params, replacer));
+ }
}
this._queue[PARAMS].push(params); |
…appening on V8. This is caused by an incompatibility between V8's Object.freeze() functionality and the react-native blob module. Since the deepFreeze function in this instance is only a developer utility and not a requirement, this can safely be silenced. See Kudo/react-native-v8#27 for more context
Thanks for the briefly information, I will try to find the root cause accordingly. |
@mcuelenaere Do you mind to provide blob data to be |
this is the stacktrace:
and these are
My hypothesis is that the |
@mcuelenaere Could you double confirm react-native version is 0.60.5 and react-native-v8 version is For the V8 problem, V8 cannot do Object.freeze on object with interceptors. |
@Kudo yes, that's because we use a fork of 0.60.5 with some fixes from 0.61 cherry picked on top (see https://github.com/getdelta/react-native/commits/0.60-patched%2Bv8 ) |
@mcuelenaere Thanks, I was able to reproduce the problem from your forked and the code. const TestCase = async () => {
const resp = await fetch('http://www.africau.edu/images/default/sample.pdf', {
method: 'GET',
});
const respBlob = await resp.blob();
await AsyncStorage.setItem('foo', respBlob);
console.log('respBlob', respBlob);
}; Passing an JSI hosted object through RN bridge will cause the problem. Unfortunately, I have no proper solution in the mean time. Thank you. |
@mcuelenaere I've sent a PR to address the issue. |
Hi there. I have the same problem with RN version |
@mcuelenaere @winseyli Considering the PR not updated for a while, I finally decide to workaround the issue in V8. |
@Kudo Thanks it works 👍 |
Thanks for taking the time to fix this @Kudo, the update works and our app is working again! |
…appening on V8. This is caused by an incompatibility between V8's Object.freeze() functionality and the react-native blob module. Since the deepFreeze function in this instance is only a developer utility and not a requirement, this can safely be silenced. See Kudo/react-native-v8#27 for more context
…appening on V8. This is caused by an incompatibility between V8's Object.freeze() functionality and the react-native blob module. Since the deepFreeze function in this instance is only a developer utility and not a requirement, this can safely be silenced. See Kudo/react-native-v8#27 for more context
…appening on V8. This is caused by an incompatibility between V8's Object.freeze() functionality and the react-native blob module. Since the deepFreeze function in this instance is only a developer utility and not a requirement, this can safely be silenced. See Kudo/react-native-v8#27 for more context
When running RN 0.60.5 with V8, in development mode the "Malformed calls from JS: field sizes are different" error gets triggered for our code.
When investigating, this seems to be caused by JS trying to freeze the params that are being passed to the bridge at https://github.com/facebook/react-native/blob/master/Libraries/BatchedBridge/MessageQueue.js#L313.
Object.freeze()
throws an error with the unhelpful message "Cannot freeze".When JSONifying the particular object that is being froze, this is what I see:
[{"size":228,"offset":0,"blobId":"f7ece23d-646d-4e09-ba54-0e855932ed26","__collector":{}},"UTF-8",22900,22901]
.My hypothesis is that V8 is somehow unable to freeze this particular blob object, while this was possible in JSC/Hermes.
I'll workaround the issue by catching the error and ignoring it (since this is only trying to help the developer and not a strict requirement), but this information might be useful to others and/or this issue might want to be looked into.
The text was updated successfully, but these errors were encountered: