-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
How frequently does the bug occur?
Sometimes
Description
Following realm/realm-swift#7868 I have another issue while saving Decimal128 values. Sometimes, the app crashes when inserting a Decimal128 value that has large significant digits. I noticed that it happens for quotient values less than 100.
For example, app crashes using the same values from the referenced issue:
@Persisted var grossPrice: Decimal128 = 70 @Persisted var vatValue: Double = 1.09 grossPrice / Decimal128(floatLiteral: vatValue) = +6422018348623853211009174311926606E-32
I randomly tested quotient values greater than 100 and it seems to work.
Stacktrace & log output
Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
* thread realm/realm-swift#1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT 0: 0x000000021af77b38 libsystem_kernel.dylib`__pthread_kill + 8 1: 0x000000025469b3bc libsystem_pthread.dylib`pthread_kill + 268 2: 0x00000001ee63f44c libsystem_c.dylib`__abort + 128 3: 0x00000001ee62a868 libsystem_c.dylib`__stack_chk_fail + 96 4: 0x0000000103f7cc68 Test Decimal128`realm::sync::ChangesetEncoder::append_value(this=0x000000013e834e60, id=Decimal128 @ 0x000000016d3c41b8) at changeset_encoder.cpp:408:1 5: 0x0000000103f7c898 Test Decimal128`realm::sync::ChangesetEncoder::append_value(this=0x000000013e834e60, payload=0x000000016d3c4560) at changeset_encoder.cpp:91:20 6: 0x0000000103f7c70c Test Decimal128`void realm::sync::ChangesetEncoder::append_path_instr<realm::sync::instr::Payload const&, bool const&>(this=0x000000013e834e60, t=Update, instr=0x000000016d3c4520, args=0x000000016d3c4560, args=0x000000016d3c4588) at changeset_encoder.cpp:303:6 7: 0x0000000103f7c5a0 Test Decimal128`realm::sync::ChangesetEncoder::operator(this=0x000000013e834e60, instr=0x000000016d3c4520)(realm::sync::instr::Update const&) at changeset_encoder.cpp:53:9 8: 0x0000000103feba7c Test Decimal128`void realm::sync::SyncReplication::emit<realm::sync::instr::Update>(this=0x000000013e834e00, instruction=Update @ 0x000000016d3c4520) at instruction_replication.hpp:174:5 9: 0x0000000103fec4e0 Test Decimal128`realm::sync::SyncReplication::set(this=0x000000013e834e00, table=0x000000013e061c00, col=(value = 8590655502), key=(value = 10), value=Mixed @ 0x000000016d3c4700, variant=instr_Set) at instruction_replication.cpp:533:9 10: 0x0000000103aeadf4 Test Decimal128`realm::Obj& realm::Obj::set<realm::Decimal128>(this=0x000000016d3c5028, col_key=(value = 8590655502), value=Decimal128 @ 0x000000016d3c48f8, is_default=false) at obj.cpp:1666:15 11: 0x00000001036720e4 Test Decimal128`void realm::(anonymous namespace)::ValueUpdater<objc_object* __strong, RLMAccessorContext>::operator(this=0x000000016d3c4aa0, (null)=0x0000000000000000)<realm::Decimal128>(realm::Decimal128*) at object_accessor.hpp:115:17 12: 0x0000000103670054 Test Decimal128`auto realm::switch_on_type<realm::Obj, realm::(anonymous namespace)::ValueUpdater<objc_object* __strong, RLMAccessorContext>&>(type=Decimal, fn=0x000000016d3c4aa0)::ValueUpdater<objc_object* __strong, RLMAccessorContext>&) at property.hpp:247:20 13: 0x000000010366fa40 Test Decimal128`void realm::Object::set_property_value_impl<objc_object* __strong, RLMAccessorContext>(this=0x000000016d3c5018, ctx=0x000000016d3c5990, property=0x000000013e0cf218, value=0x0000000280673c40, policy=(create = true, copy = false, update = true, diff = false), is_default=false) at object_accessor.hpp:173:5 14: 0x0000000103655de4 Test Decimal128`realm::Object realm::Object::create<objc_object* __strong, RLMAccessorContext>(ctx=0x000000016d3c5990, realm=std::__1::shared_ptr<realm::Realm>::element_type @ 0x000000013de1c638 strong=39 weak=5, object_schema=0x000000013e0cc700, value=0x000000013f7072b0, policy=(create = true, copy = false, update = true, diff = false), current_obj=(value = -1), out_row=0x000000013f7072b8) at object_accessor.hpp:362:20 15: 0x0000000103654b84 Test Decimal128`RLMAccessorContext::createObject(this=0x000000016d3c5990, value=0x000000013f7072b0, policy=(create = true, copy = false, update = true, diff = false), forceCreate=false, existingKey=(value = -1)) at RLMAccessor.mm:1102:9 16: 0x000000010374db38 Test Decimal128`RLMAddObjectToRealm(object=0x000000013f7072b0, realm=0x000000028315cd10, updatePolicy=RLMUpdatePolicyUpdateAll) at RLMObjectStore.mm:119:7 17: 0x0000000104353d60 Test Decimal128`Realm.add(object=0x000000013f7072b0, update=all, self=RealmSwift.Realm @ 0x000000016d3c5ba8) at Realm.swift:540:9
Can you reproduce the bug?
Yes, always
Reproduction Steps
No response
Version
10.28.4
What SDK flavour are you using?
MongoDB Realm (i.e. Sync, auth, functions)
Are you using encryption?
Yes, using encryption
Platform OS and version(s)
iOS 15.6
Build environment
Xcode version: 14.0 beta 4