-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
7177
-
Core Realm
Slack Thread captured from #privategroup by kiro.morkos@mongodb.com
- kiro.morkos@mongodb.com: Looking at a HELP ticket - this app is getting an error about a table name being too long during client reset, but not during normal bootstrap
``` {"@t":"2023-11-29T16:27:43.2410074-06:00","@m":"Connection[2]: Session[5]: A fatal error occurred during client reset: 'class name too long (version: 0, last_integrated_remote_version: 0, origin_file_ident: 0, timestamp: 0). Please contact support.'","@l":"Error","SourceContext":"RealmSdk"}```
It appears that <https://github.com/realm/realm-core/blob/bc487096035a25e4d80e9b81e17d912d004047dd/src/realm/sync/instruction_applier.cpp#L88-L94|this method>, which is only used during client reset, enforces a max length of 57 characters (i assume the -6 comes from `class_`), and the app does indeed have a table with 58 characters. any idea why the normal bootstrap allows this table name? - jonathan.reams@mongodb.com: because by the time you're able to bootstrap you've already created all your tables/columns?
- jonathan.reams@mongodb.com: i don't know why that function is only used in client resets though
- jonathan.reams@mongodb.com: :diglett:
- kiro.morkos@mongodb.com: sorry, by "bootstrap" i meant the non-client reset case.
- kiro.morkos@mongodb.com: like when they connect and do schema exchange outside of client reset, they don't hit this invariant
- jonathan.reams@mongodb.com: yeah, i think this may just be a case of the shrugs. going back 3 years that function is still unused
- jonathan.reams@mongodb.com: i don't know if there was a historical reason for only allowing 57 characters.
- kiro.morkos@mongodb.com: but wouldn't the validation fail here in the non-client reset case? <https://github.com/realm/realm-core/blob/bc487096035a25e4d80e9b81e17d912d004047dd/src/realm/group.cpp#L679> or does that `name` not include the `class_` prefix?
- jonathan.reams@mongodb.com: :psyduck:
- thomas.goyne@mongodb.com: there's an off-by-one error there
- thomas.goyne@mongodb.com: should be `class_name.size() > Group::max_table_name_length - 6`
- jonathan.reams@mongodb.com: ah, the best kind of error.
- kiro.morkos@mongodb.com: ooooo wow :facepalm: . that explains why a 58-character table name slips through the cracks :upside_down_face:
- kiro.morkos@mongodb.com: wait, that would still fail though?
`class_name.size() = 58`
`58 > 63 - 6` and `58 >= 63-6`
in the other codepath
`name.size() = 64`
`64 > 63` <-- why is this okay? or does `name` not include `class_` here either?
- thomas.goyne@mongodb.com: what 64 character long name do they have? the longest table name I can find in the logs attached to that ticket is `class_FieldResultDoc_tableResults_tableResults_checkListOptions` , which is 63
- kiro.morkos@mongodb.com: The table name is `ECQTSFIBERRESULTDOC_WAVELENGTHRESULTS_MEDIALIST_CUSTOMTAGS`
- jonathan.reams@mongodb.com: did y'all figure this one out?
- kiro.morkos@mongodb.com: i don't think so. i can file an rcore so it doesn't get lost