realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.78k stars 573 forks source link

App Crashed once data retrieved from realm schema #2330

Closed Adichilla closed 4 years ago

Adichilla commented 5 years ago

What are you trying to achieve? I am trying to insert data into realm database using Schema Data inserted successfully and retrieve also success once data retrieved app getting crashed in iOS.

What did you expect to happen? It will not close the App

What happened instead? App getting crashed

The stack trace of a crash Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)

Firebase Crash Log Crashed: com.apple.main-thread EXC_BREAKPOINT EXC_I386_NMIFLT 0x0000000000000000

RLMRealm notification listener

TestApp external_commit_helper.cpp - Line 216 realm::_impl::ExternalCommitHelper::listen()

TestApp external_commit_helper.cpp - Line 173 realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0::operator()() const

TestApp type_traits - Line 4428 void std::1::thread_proxy<std::1::tuple<std::1::unique_ptr<std::1::thread_struct, std::__1::default_delete >, realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >(void)

Steps to Reproduce

What are steps we can follow to reproduce this issue? Initialize DB with any one of the schemas insert data and retrieve it run your project Add debugger

Code Sample

const OtherDetail = { name : 'OtherDetail', properties : { hobby : 'string[]', sports : 'string[]' } }

const PersonSchema = { name: 'PersonSchema', properties: { realName: 'string', displayName: 'string', arrPer : {type : 'list', objectType : 'OtherDetail'}, birthday: 'date' } };

`

saveData() {
    let realm = new Realm({schema: [PersonSchema, OtherDetail]});
    realm.write(() => {
        let other = realm.create('OtherDetail', {
            hobby : ['book','technology'],
            sports : ['football','baseball']
        })
        let person = realm.create('PersonSchema', {  
            realName:     'steve smith',
            displayName: 'steven',
            birthday: new Date()
        });
        person.arrPer.push(other);
    });
}

`

`

getData() {
    let hobby = []
    let sports = []
    Realm.open({
      schema: [PersonSchema, OtherDetail]
    }).then(realm => {
        realm.objects('PersonSchema').map( (res) => {
            hobby = []
            sports = []
            res.arrPer.map( (res) => {
                res.hobby.map( (res) => {
                    hobby.push(res)
                })
                res.sports.map( (res) => {
                    sports.push(res)
                })
            })
        })
    });
}`

Version of Realm and Tooling

kneth commented 5 years ago

Do you only observe it when debugging. Please upgrade to a recent version (v2.28.0 or later) and try again.

kneth commented 4 years ago

I am closing the issue (no activity).