realm / realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.
Apache License 2.0
878 stars 52 forks source link

Crash when enabling trace level logging for synced realm and updating property to `RealmInstant.MIN` #1760

Open rorbech opened 1 month ago

rorbech commented 1 month ago

How frequently does the bug occur?

Always

Description

When enabling trace level debugging for a synced realm, logging will crash if you assign RealmInstant.MIN to a timestamp property. Its caused by ill-formatted date due to https://github.com/realm/realm-core/issues/6892#issuecomment-2124605967

Stacktrace & log output

2024-05-18 14:38:01.955 30754-30843 lm.sync.testap          io.realm.sync.testapp                A  java_vm_ext.cc:579] JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal continuation byte 0x2d
                                                                                                    java_vm_ext.cc:579]     string: 'Failure when converting long string to UTF-16 error_code = 2; retcode = 0; StringData.size = 91; StringData.data = DB: 62097 Thread 492441812144:    Set 'realmInstantField' to -188?-01-5: 15:30:07.000000001; StringData as hex =  0x44 0x42 0x3a 0x20 0x36 0x32 0x30 0x39 0x37 0x20 0x54 0x68 0x72 0x65 0x61 0x64 0x20 0x34 0x39 0x32 0x34 0x34 0x31 0x38 0x31 0x32 0x31 0x34 0x34 0x3a 0x20 0x20 0x20 0x20 0x53 0x65 0x74 0x20 0x27 0x72 0x65 0x61 0x6c 0x6d 0x49 0x6e 0x73 0x74 0x61 0x6e 0x74 0x46 0x69 0x65 0x6c 0x64 0x27 0x20 0x74 0x6f 0x20 0x2d 0x31 0x38 0x38 0xde 0x2d 0x30 0x31 0x2d 0x35 0x3a 0x20 0x31 0x35 0x3a 0x33 0x30 0x3a 0x30 0x37 0x2e 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x31; in_begin = ?-01-5: 15:30:07.000000001; in_end = ; out_curr = 0xb4000073faa0b072; out_end = 0xb4000073faa0b104;'
2024-05-18 14:38:01.955 30754-30843 lm.sync.testap          io.realm.sync.testapp                A  java_vm_ext.cc:579]     input: '0x46 0x61 0x69 0x6c 0x75 0x72 0x65 0x20 0x77 0x68 0x65 0x6e 0x20 0x63 0x6f 0x6e 0x76 0x65 0x72 0x74 0x69 0x6e 0x67 0x20 0x6c 0x6f 0x6e 0x67 0x20 0x73 0x74 0x72 0x69 0x6e 0x67 0x20 0x74 0x6f 0x20 0x55 0x54 0x46 0x2d 0x31 0x36 0x20 0x65 0x72 0x72 0x6f 0x72 0x5f 0x63 0x6f 0x64 0x65 0x20 0x3d 0x20 0x32 0x3b 0x20 0x72 0x65 0x74 0x63 0x6f 0x64 0x65 0x20 0x3d 0x20 0x30 0x3b 0x20 0x53 0x74 0x72 0x69 0x6e 0x67 0x44 0x61 0x74 0x61 0x2e 0x73 0x69 0x7a 0x65 0x20 0x3d 0x20 0x39 0x31 0x3b 0x20 0x53 0x74 0x72 0x69 0x6e 0x67 0x44 0x61 0x74 0x61 0x2e 0x64 0x61 0x74 0x61 0x20 0x3d 0x20 0x44 0x42 0x3a 0x20 0x36 0x32 0x30 0x39 0x37 0x20 0x54 0x68 0x72 0x65 0x61 0x64 0x20 0x34 0x39 0x32 0x34 0x34 0x31 0x38 0x31 0x32 0x31 0x34 0x34 0x3a 0x20 0x20 0x20 0x20 0x53 0x65 0x74 0x20 0x27 0x72 0x65 0x61 0x6c 0x6d 0x49 0x6e 0x73 0x74 0x61 0x6e 0x74 0x46 0x69 0x65 0x6c 0x64 0x27 0x20 0x74 0x6f 0x20 0x2d 0x31 0x38 0x38 0xde <0x2d> 0x30 0x31 0x2d 0x35 0x3a 0x20 0x31 0x35 0x3a 0x33 0x30 0x3a 0x30 0x37 0x2e 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x31 0x3b 0x20 0x53 0x74 0x72 0x69 0x6e 0x67 0x44 0x61 0x74 0x61 0x20 0x61 0x73 0x20 0x68 0x65 0x78 0x20 0x3d 0x20 0x20 0x30 0x78 0x34 0x34 0x20 0x30 0x78 0x34 0x32 0x20 0x30 0x78 0x33 0x61 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x33 0x36 0x20 0x30 0x78 0x33 0x32 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x39 0x20 0x30 0x78 0x33 0x37 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x35 0x34 0x20 0x30 0x78 0x36 0x38 0x20 0x30 0x78 0x37 0x32 0x20 0x30 0x78 0x36 0x35 0x20 0x30 0x78 0x36 0x31 0x20 0x30 0x78 0x36 0x34 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x33 0x34 0x20 0x30 0x78 0x33 0x39 0x20 0x30 0x78 0x33 0x32 0x20 0x30 0x78 0x33 0x34 0x20 0x30 0x78 0x33 0x34 0x20 0x30 0x78 0x33 0x31 0x20 0x30 0x78 0x33 0x38 0x20 0x30 0x78 0x33 0x31 0x20 0x30 0x78 0x33 0x32 0x20 0x30 0x78 0x33 0x31 0x20 0x30 0x78 0x33 0x34 0x20 0x30 0x78 0x33 0x34 0x20 0x30 0x78 0x33 0x61 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x35 0x33 0x20 0x30 0x78 0x36 0x35 0x20 0x30 0x78 0x37 0x34 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x32 0x37 0x20 0x30 0x78 0x37 0x32 0x20 0x30 0x78 0x36 0x35 0x20 0x30 0x78 0x36 0x31 0x20 0x30 0x78 0x36 0x63 0x20 0x30 0x78 0x36 0x64 0x20 0x30 0x78 0x34 0x39 0x20 0x30 0x78 0x36 0x65 0x20 0x30 0x78 0x37 0x33 0x20 0x30 0x78 0x37 0x34 0x20 0x30 0x78 0x36 0x31 0x20 0x30 0x78 0x36 0x65 0x20 0x30 0x78 0x37 0x34 0x20 0x30 0x78 0x34 0x36 0x20 0x30 0x78 0x36 0x39 0x20 0x30 0x78 0x36 0x35 0x20 0x30 0x78 0x36 0x63 0x20 0x30 0x78 0x36 0x34 0x20 0x30 0x78 0x32 0x37 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x37 0x34 0x20 0x30 0x78 0x36 0x66 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x32 0x64 0x20 0x30 0x78 0x33 0x31 0x20 0x30 0x78 0x33 0x38 0x20 0x30 0x78 0x33 0x38 0x20 0x30 0x78 0x64 0x65 0x20 0x30 0x78 0x32 0x64 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x31 0x20 0x30 0x78 0x32 0x64 0x20 0x30 0x78 0x33 0x35 0x20 0x30 0x78 0x33 0x61 0x20 0x30 0x78 0x32 0x30 0x20 0x30 0x78 0x33 0x31 0x20 0x30 0x78 0x33 0x35 0x20 0x30 0x78 0x33 0x61 0x20 0x30 0x78 0x33 0x33 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x61 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x37 0x20 0x30 0x78 0x32 0x65 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x30 0x20 0x30 0x78 0x33 0x31 0x3b 0x20 0x69 0x6e 0x5f 0x62 0x65 0x67 0x69 0x6e 0x20 0x3d 0x20 0xde 0x2d 0x30 0x31 0x2d 0x35 0x3a 0x20 0x31 0x35 0x3a 0x33 0x30 0x3a 0x30 0x37 0x2e 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x31 0x3b 0x20 0x69 0x6e 0x5f 0x65 0x6e 0x64 0x20 0x3d 0x20 0x3b 0x20 0x6f 0x75 0x74 0x5f 0x63 0x75 0x72 0x72 0x20 0x3d 0x20 0x30 0x78 0x62 0x34 0x30 0x30 0x30 0x30 0x37 0x33 0x66 0x61 0x61 0x30 0x62 0x30 0x37 0x32 0x3b 0x20 0x6f 0x75 0x74 0x5f 0x65 0x6e 0x64 0x20 0x3d 0x20 0x30 0x78 0x62 0x34 0x30 0x30 0x30 0x30 0x37 0x33 0x66 0x61 0x61 0x30 0x62 0x31 0x30 0x34 0x3b'
2024-05-18 14:38:01.955 30754-30843 lm.sync.testap          io.realm.sync.testapp                A  java_vm_ext.cc:579]     in call to NewStringUTF
                                                                                                    java_vm_ext.cc:579]     from boolean io.realm.kotlin.internal.interop.realmcJNI.realm_set_value(long, long, long, io.realm.kotlin.internal.interop.realm_value_t, boolean)
2024-05-18 14:38:02.082 30754-30843 lm.sync.testap          io.realm.sync.testapp                A  runtime.cc:669] Runtime aborting...

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

1.16.0

What Atlas App Services are you using?

Atlas Device Sync

Are you using encryption?

No

Platform OS and version(s)

JVM 11 or Android API level 31, but don't think it is relevant.

Build environment

No response

sync-by-unito[bot] commented 1 month ago

➤ PM Bot commented:

Jira ticket: RKOTLIN-1089