Skip to content
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

Opening on app start results in crash #7926

Closed
mr-grey opened this issue Aug 24, 2022 · 9 comments
Closed

Opening on app start results in crash #7926

mr-grey opened this issue Aug 24, 2022 · 9 comments
Labels
O-Community T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed

Comments

@mr-grey
Copy link

mr-grey commented Aug 24, 2022

How frequently does the bug occur?

Sometimes

Description

App crash at start

User had constants crash when opening the app appstore version.
We gave him latest testflight build, was the same.

Screenshot 2022-08-24 at 16 37 09

Stacktrace & log output

Thread 5 name:
Thread 5 Crashed:
0   libsystem_kernel.dylib        	0x00000001dce3db38 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x0000000216bab3bc pthread_kill + 268 (pthread.c:1668)
2   libsystem_c.dylib             	0x00000001b03ab44c __abort + 128 (abort.c:155)
3   libsystem_c.dylib             	0x00000001b0353530 abort + 180 (abort.c:126)
4   Realm                         	0x0000000108e3a348 please_report_this_issue_in_github_realm_realm_core + 12
5   Realm                         	0x0000000108e3a630 realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 260
6   Realm                         	0x0000000108e3a82c realm::util::terminate_with_info(char const*, char const*, long, char const*, std::initializer_list<realm::util::Printable>&&) + 388
7   Realm                         	0x0000000108cbb65c void realm::util::terminate_with_info<unsigned long&, unsigned long&, unsigned long const&, unsigned long&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(c... + 136
8   Realm                         	0x0000000108cbb434 realm::SlabAlloc::do_free(unsigned long, char*) + 1720
9   Realm                         	0x0000000108d12fe8 realm::WrappedAllocator::do_free(unsigned long, char*) + 24
10  Realm                         	0x0000000108ccaf18 realm::Array::destroy_deep(realm::MemRef, realm::Allocator&) + 60
11  Realm                         	0x0000000108ccae5c realm::Array::destroy_deep(unsigned long, realm::Allocator&) + 140
12  Realm                         	0x0000000108cbf124 realm::Array::destroy_children(unsigned long) + 116
13  Realm                         	0x0000000108ccaf80 realm::Array::destroy_deep(realm::MemRef, realm::Allocator&) + 164
14  Realm                         	0x0000000108ccae5c realm::Array::destroy_deep(unsigned long, realm::Allocator&) + 140
15  Realm                         	0x0000000108ce1a50 realm::Cluster::remove_column(realm::ColKey) + 68
16  Realm                         	0x0000000108ceea9c realm::ClusterNodeInner::remove_column(realm::ColKey) + 168
17  Realm                         	0x0000000108decaf4 realm::Table::do_erase_root_column(realm::ColKey) + 252
18  Realm                         	0x0000000108dea86c realm::Table::erase_root_column(realm::ColKey) + 172
19  Realm                         	0x0000000108dea5d8 realm::Table::remove_column(realm::ColKey) + 156
20  Realm                         	0x0000000108f54eb8 apply_post_migration_changes(realm::Group&, std::__1::vector<realm::SchemaChange, std::__1::allocator<realm::SchemaChange> > const&, realm::Schema const&, DidRereadSchema) + 376
21  Realm                         	0x0000000108f54454 realm::ObjectStore::apply_schema_changes(realm::Transaction&, unsigned long long, realm::Schema&, unsigned long long, realm::SchemaMode, std::__1::vector<realm::SchemaChange, std::__1::allocator<re... + 3516
22  Realm                         	0x0000000108fb0ecc realm::Realm::update_schema(realm::Schema, unsigned long long, std::__1::function<void (std::__1::shared_ptr<realm::Realm>, std::__1::shared_ptr<realm::Realm>, realm::Schema&)>, std::__1::function<... + 368
23  Realm                         	0x0000000108c8cd28 +[RLMRealm realmWithConfiguration:queue:error:] + 1988 (RLMRealm.mm:594)
24  RealmSwift                    	0x00000001084e63c8 $sSo8RLMRealmC13configuration5queueABSo0A13ConfigurationC_So012OS_dispatch_C0CSgtKcfCTOTf4ggn_n + 40 (<compiler-generated>:0)
25  RealmSwift                    	0x00000001084e63c8 $sSo8RLMRealmC13configuration5queueABSo0A13ConfigurationC_So012OS_dispatch_C0CSgtKcfCTO + 40 (<compiler-generated>:0)
26  RealmSwift                    	0x00000001084e63c8 Realm.init(configuration:queue:) + 92 (Realm.swift:95

Can you reproduce the bug?

Not yet

Reproduction Steps

No response

Version

10.28.2

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

iOS

Build environment

Xcode version: Version 13.3.1 (13E500a)

AppStoreTools: 13F100
AppVariant: 1:iPhone13,4:15
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]

@leemaguire
Copy link
Contributor

@mr-grey can you show us your migration script? And maybe a bit more about if during the migration Realm version where updated, what changes your made to you Realm model etc.

@mr-grey
Copy link
Author

mr-grey commented Aug 24, 2022

prev release version was 'realmConfig.schemaVersion = 1528'

   var realmConfig = Realm.Configuration()
        realmConfig.schemaVersion = 1529
        realmConfig.encryptionKey = nil
        realmConfig.migrationBlock = { migration, oldSchemaVersion in
          
          log.debug("Realm migrate from oldSchemaVersion=\(oldSchemaVersion) to migration=\(migration)")
          log.debug("migration" + (Thread.current.isMainThread ? "on MainThread" : "on background thred" ))
          DispatchQueue.main.async {
              RealmManager.dispayProcessController()
          }
          
          if oldSchemaVersion <= 1528 {
                migration.enumerateObjects(ofType: RLMRealmIdentifiedUser.className()) { (oldObject, newObject) in
                    newObject?.phoneNumber = oldObject?.phoneNumber
                    newObject?.identifiedDate = oldObject?.identifiedDate
                    newObject?.tagString = oldObject?.tagString
                    newObject?.fullPhoneNumber = oldObject?.fullPhoneNumber
                    newObject?.name = oldObject?.name
                }
            
            }
            
            if oldSchemaVersion <= 1525 {
                migration.enumerateObjects(ofType: RealmUser.className()) { (_, newObject) in
                    newObject?["socialTiktokIsActive"] = false
                    newObject?["socialTiktokIsHidden"] = true
                    newObject?["socialTiktokProfileId"] = ""
                }
            }
            
            if oldSchemaVersion <= 1524 {
                migration.enumerateObjects(ofType: RealmUser.className()) { (_, newObject) in
                    newObject?["countryCode"] = ""
                }
            }
}

but in crash log I see migrationBlock not executed

@leemaguire
Copy link
Contributor

@mr-grey did you remove a property from any of your Realm object models?

@mr-grey
Copy link
Author

mr-grey commented Aug 24, 2022

there was old UNREALM library , and was properties like this __nilProperties , and some optional prop.
all models was named RLM+Modelname.

in current version was created the same models , and removed __nilProperties, and changes prop optionality

@mr-grey
Copy link
Author

mr-grey commented Aug 24, 2022

I can provide empty old realm file if needed

@leemaguire
Copy link
Contributor

Sure @mr-grey send it to realm-help@mongodb.com If you could also send on a small sample app which performs the migration from the old realm file to the new schema version that would be great!

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Aug 24, 2022
@dianaafanador3
Copy link
Contributor

@mr-grey we haven't receive anything at realm-help@mongodb.com, If you could send us the old realm and some code snippers or sample app with the migration code.

@leemaguire
Copy link
Contributor

@mr-grey Could you provide us with more information?

@sync-by-unito sync-by-unito bot changed the title please_report_this_issue_in_github_realm_realm_core Opening on app start results in crash Sep 27, 2022
@dianaafanador3
Copy link
Contributor

Closing this as it seems like an issue on the migration code, and the we haven't receive any response from the user.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
O-Community T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed
Projects
None yet
Development

No branches or pull requests

3 participants