alpha-wallet-ios icon indicating copy to clipboard operation
alpha-wallet-ios copied to clipboard

`RLMException, reason: String too big`

Open oa-s opened this issue 3 years ago • 13 comments

@hboon do you have any ideas of fixing this issue?

https://console.firebase.google.com/u/0/project/alphawallet-ios-prod/crashlytics/app/ios:com.stormbird.alphawallet/issues/087983306e9dd43e58732fcfac54a7b9?time=last-twenty-four-hours&sessionEventKey=90639cde2eb6426081d6f36049c5d468_1674795446825436627

oa-s avatar May 11 '22 05:05 oa-s

@hboon does it means that we trying to store single string that is larger then 16mb?

oa-s avatar May 11 '22 06:05 oa-s

Looking… Strange that it says it's a regression from v3.40 (427) and was closed. I checked the closed issues and it's not there.

Screenshot 2022-05-11 at 3 58 27 PM

hboon avatar May 11 '22 07:05 hboon

@hboon does it means that we trying to store single string that is larger then 16mb?

Seems so according to https://www.mongodb.com/docs/realm-legacy/docs/swift/latest/#current-limitations

Data and String properties cannot hold data exceeding 16MB in size. To store larger amounts of data, either break it up into 16MB chunks or store it directly on the file system, storing paths to these files in the Realm. An exception will be thrown at runtime if your app attempts to store more than 16MB in a single property.

Is it possible?

hboon avatar May 11 '22 08:05 hboon

it couble be good to find our that exactly is large for storing, added pr to track users selected wallet address, for later watch ing and trying to reproduce

oa-s avatar May 11 '22 08:05 oa-s

OK

hboon avatar May 11 '22 08:05 hboon

@hboon i have suggestion about this issue, what if we update our code base to save balance json as file, like we do for erc1155, and store file url in realm instead whole json string?

oa-s avatar Jun 20 '22 10:06 oa-s

we also can track json strings that is greater than 16 mb, and skip such balances, but i don't think that its a good idea.

oa-s avatar Jun 20 '22 10:06 oa-s

it might happen, when json contains base64 data for images, that might happen quite ofter

oa-s avatar Jun 20 '22 10:06 oa-s

any suggestions?

oa-s avatar Jun 20 '22 10:06 oa-s

@hboon i have suggestion about this issue, what if we update our code base to save balance json as file, like we do for erc1155, and store file url in realm instead whole json string?

@oa-s hmm. But wondering if that will end up with many loose files. Is there a Blob type? What if we convert to Data when we store JSON strings? I suppose the Realm size limitation is because of indexing performance rather than storage?

hboon avatar Jun 20 '22 11:06 hboon

not sure, as there same limitation for String, Data types, max file size is 16 mb

oa-s avatar Jun 20 '22 17:06 oa-s

But wondering if that will end up with many loose files. Is there a Blob type?

oh yes, it cold be..

oa-s avatar Jun 20 '22 17:06 oa-s

not sure, as there same limitation for String, Data types, max file size is 16 mb

I see. Since we are guessing that it's images that are base64 encoded in the JSON, do you want to do a size check for them and log if it exceeds a certain size? (say 2MB?) to Firebase? Then if it crashes we ought to pick it up. Maybe log these:

  • URL where we picked up the JSON from
  • Contract + chain
  • Token ID

?

hboon avatar Jun 21 '22 05:06 hboon