Skip to content

Crash on iOS 14.5 beta: Attempting to change configurable attribute of unconfigurable property #3557

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

Closed
howg0924 opened this issue Feb 4, 2021 · 23 comments
Assignees

Comments

@howg0924
Copy link

howg0924 commented Feb 4, 2021

Expected Results

Not to crash.

Actual Results

Crashed on iOS 14.5 beta. All other iOS versions are fine.

If we don't use Realm in JS, then everything is fine. But if we add one line to import Realm:

import Realm from 'realm';

It crashed with the following error: Attempting to change configurable attribute of unconfigurable property.

And crashed when running the following Object.defineProperties() in lib/extensions.js of realm-js:

Object.defineProperties(realmConstructor, getOwnPropertyDescriptors({
    _extendQueryBasedSchema(schema) {
        addSchemaIfNeeded(schema, realmConstructor.Permissions.Class);
        addSchemaIfNeeded(schema, realmConstructor.Permissions.Permission);
        addSchemaIfNeeded(schema, realmConstructor.Permissions.Realm);
        addSchemaIfNeeded(schema, realmConstructor.Permissions.Role);
        addSchemaIfNeeded(schema, realmConstructor.Permissions.User);
        addSchemaIfNeeded(schema, realmConstructor.Subscription.ResultSets);
    },

    // Creates the user agent description for the JS binding itself. Users must specify the application
    // user agent using Realm.Sync.setUserAgent(...)
    _createUserAgentDescription() {
        // Detect if in ReactNative (running on a phone) or in a Node.js environment
        // Credit: https://stackoverflow.com/questions/39468022/how-do-i-know-if-my-code-is-running-as-react-native
        try {
            var userAgent = "RealmJS/";
            userAgent = userAgent + require('../package.json').version + " (" + context + ", ";
            if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
                // Running on ReactNative
                const Platform = require('react-native').Platform;
                userAgent += Platform.OS + ", v" + Platform.Version;
            } else {
                // Running on a normal machine
                userAgent += process.version;
            }
            return userAgent += ")";
        } catch (e) {
            return "RealmJS/Unknown"
        }
    },
}));

Maybe due to some change in iOS 14.5 JavaScript core?

Simulator Screen Shot - iPhone 8 - 2021-02-04 at 17 03 48

Steps to Reproduce

1.Setup a RN project and import realm-js
2.Run the App on iOS 14.5 beta.

Not sure whether it's related to my RN version (0.59). But it all worked fine until the recently released iOS 14.5 beta.
Tried Relam JS 5.0.5 and 6.1.5, both has the same issue.

Code Sample

import Realm from 'realm';

Version of Realm and Tooling

  • Realm JS SDK Version: 5.0.5 and 6.1.5
  • Node or React Native: RN 0.59.10
  • Client OS & Version: iOS 14.5 beta
  • Which debugger for React Native: None
@lakhman
Copy link

lakhman commented Feb 4, 2021

We are also experiencing this same issue relating to iOS 14.5 beta.

Version of Realm and Tooling

Realm JS SDK Version: 3.6.3 & 6.1.5
Node or React Native: RN 0.63.4
Client OS & Version: iOS 14.5 beta
Which debugger for React Native: None

@kneth
Copy link
Contributor

kneth commented Feb 5, 2021

Thank you for bringing it to our attention. It looks like a change in iOS 14.5 beta which we have to handle. We need to investigate it (run our tests on iOS 14.5 beta).

@kneth
Copy link
Contributor

kneth commented Feb 5, 2021

The latest Xcode/iOS beta seem to bring some issues that we need to sort out.

@feiyingx
Copy link

feiyingx commented Feb 5, 2021

Thanks @kneth can you provide a rough ETA?

@Hannes-Endare
Copy link

@kneth is there any update on this? We don't want our live app to crash when iOS 14.5 releases.

@Hannes-Endare
Copy link

Hannes-Endare commented Feb 9, 2021

Upgrading to latest version of Realm seems to fix the problem. Can anyone else also confirm this?

@Frans-L
Copy link

Frans-L commented Feb 9, 2021

Upgrading to latest version of Realm seems to fix the problem. Can anyone else also confirm this?

Realm 6 or Realm 10 ? 👀

@Hannes-Endare
Copy link

Upgrading to latest version of Realm seems to fix the problem. Can anyone else also confirm this?

Realm 6 or Realm 10 ? 👀

We upgraded from 6 to 10

@mrarronz
Copy link

Hi @Hannes-Endare, does the upgrading fix this crash? We have same crash happens on the iOS 14.5 beta and are looking forward to fixing this before the iOS 14.5 formal version release.

@lakhman
Copy link

lakhman commented Feb 10, 2021

We upgraded realm js to v10.2.0 from 3.6.3, initial testing shows this fixed the issue, the app no longer crashes on iOS 14.5 beta.

@mrarronz
Copy link

mrarronz commented Feb 11, 2021

I tried to upgrade realm from v3.2.0 to v10.2.0, but always failed with "missing realm constructor", I searched the related issues and tried all the solutions but still failed with missing realm constructor. The error message is useless, of course we did pod install, RN version is 0.61.5, really upset about this.

@lakhman @Hannes-Endare Could you please help with this? What are your migration steps?

@lakhman
Copy link

lakhman commented Feb 11, 2021

@mrarronz We didn't have any issues upgrading, install realm version 10.2.0, pod install inside ios directory, open xcode - clear all build cache - rebuild, worked first time without any issues.
Note: we are not using any "realm cloud/sync" functionality - we only use the realm database to store app data.

@Hannes-Endare
Copy link

@mrarronz make sure you initialise Realm in the correct way. I'm not familiar with 3.2.0 but maybe they changed something in init phase?

@Frans-L
Copy link

Frans-L commented Feb 11, 2021

@kneth Do you have any rough estimation when Realm 6 is going to be patched? 😄

Is it going to take days, weeks, or months?

@bsk26
Copy link

bsk26 commented Feb 11, 2021

This issue also appears to have been crashing our app on 14.5 beta. Upgrading to 10.2.0 from 6.x.x was painless and appears to have fixed the crash

@steffenagger
Copy link
Contributor

steffenagger commented Feb 12, 2021

Is it going to take days, weeks, or months?

@Frans-L without promising anything specific, this should be a matter of days.

@steffenagger
Copy link
Contributor

@Frans-L v6.1.6 has been released.
Appreciate any feedback on the fix, and/or other problems encountered with the new xcode/ios beta.

@justindi15
Copy link

@steffenagger, Great work getting out a hotfix that quick. I was wondering if this change would apply for older major versions (ie. v2.92)?

@steffenagger
Copy link
Contributor

@justindi15 Thank you, and ugh - you're referencing a version that pre-dates my time in Realm :)

In general v6 is being maintained while new features goes towards v10 (using realm without sync, v6 & v10 is basically the same, with v10 seeing active developerment, so my recommendation here would be v10).

May I flip the question around and ask: what's keeping you from updating?

@bsk26
Copy link

bsk26 commented Feb 17, 2021

FYI that this issue is potentially resolved in ios 14.5 beta 2

@steffenagger
Copy link
Contributor

FYI that this issue is potentially resolved in ios 14.5 beta 2

@bsk26 can you share where you've got this information? The update to WebKit (in beta 1) now handles redefining properties correctly, in regards to the configurable option.

@bsk26
Copy link

bsk26 commented Feb 17, 2021

FYI that this issue is potentially resolved in ios 14.5 beta 2

@bsk26 can you share where you've got this information? The update to WebKit (in beta 1) now handles redefining properties correctly, in regards to the configurable option.

This is just from our testing, unfortunately you have more formal information than I do here. The app was crashing on 14.5 beta, I'm fairly certain due to this issue, and doesn't seem to be on the latest beta release.

@steffenagger
Copy link
Contributor

steffenagger commented Feb 17, 2021

That's super interesting findings! Weird, but thanks for sharing @bsk26 👍
Maybe the update broke a few too many existing implementations.

We'll at least have it on our radar going forward.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants