-
Notifications
You must be signed in to change notification settings - Fork 87
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
RealmException: No such table exists. Error code: 3020.
during client reset
#1740
Comments
➤ PM Bot commented: Jira ticket: RDART-1066 |
@SPodjasek Can you share the code for your manual reset fallback?
|
Code below was at version that had issues.... Line 425 is marked by comment. onManualResetFallback: (ClientResetError clientResetError) {
Logger.log(
'Manual reset fallback',
name: 'RealmServices',
error: jsonEncode({
'message': clientResetError.message,
'code': {
'index': clientResetError.code.index,
'name': clientResetError.code.name,
},
}),
);
CrashReporting.crashlytics
.recordError(clientResetError, StackTrace.current, fatal: false);
// Prompt user to perform a client reset immediately. If they don't,
// they won't receive any data from the server until they restart the app
// and all changes they make will be discarded when the app restarts.
var didUserConfirmReset = true; //showUserAConfirmationDialog();
if (didUserConfirmReset) {
// You must close the Realm before attempting the client reset.
_close();
// Attempt the client reset.
Logger.log('Attempting client reset', name: 'RealmServices');
try {
clientResetError.resetRealm(); // <------------------------------------------ line 425
// Navigate the user back to the main page or reopen the
// the Realm and reinitialize the current page.
Logger.log('Client reset successful', name: 'RealmServices');
_initialize(user, encryptionKey);
} catch (err, stack) {
// Reset failed.
// Notify user that they'll need to update the app
Logger.log(
'Client reset failed',
name: 'RealmServices',
error: err,
);
CrashReporting.crashlytics.recordError(err, stack, fatal: true);
fatal = true;
notifyListeners();
}
} |
@nielsenko Today I've received another error of this kind in newer version, but this time stack trace points to line with just: _realm = Realm(config); Config here is Stack trace
Looking through code this time it seems that client reset failed, manual reset also failed, after that application tries to remove whole synced realm directory and tries to configure it from scratch. |
In my case, the problem is embeddedObject schema that I defined in Configuration.flexibleSync is not used in the code. |
During our update we've added two embeddedObjects, but both were used in newly added model. |
I was able to reproduce the issue where an embedded object is added without a parent. |
That's interesting because on client-side it was a single commit structured like below (some lines removed): @RealmModel(ObjectType.embeddedObject)
class _ProfileActivationInput {
String? label;
String? type;
}
@RealmModel(ObjectType.embeddedObject)
class _ProfileActivationVerification {
String? comparison;
String? error;
String? result;
DateTime? ts;
}
@RealmModel()
@MapTo('profile_activation')
class _ProfileActivation {
@PrimaryKey()
@MapTo('_id')
ObjectId? id;
DateTime? createdAt;
String? employeeId;
int? failureCount;
late List<_ProfileActivationInput> inputs;
// [...]
late List<String> values;
late List<_ProfileActivationVerification> verifications;
} And all models were added to flexible sync at same commit: static final List<SchemaObject> allSchemas = [
// [...]
ProfileActivationInput.schema,
ProfileActivationVerification.schema,
ProfileActivation.schema,
]; |
That code should be fine - it's possible you're hitting a different issue or some non-obvious manifestation of the existing one. |
My code looks similar to @SPodjasek code and results in the same error. Any ideas for a workaround? |
If you have an easy to run repro case, I should be able to track down what's wrong. Without a clear understanding of the root cause, it's not obvious to me what a workaround would look like. |
What happened?
We've added three new collections to sync schema and during client reset following exceptions were thrown on internal testing pre-production devices:
Android: ClientResetError message: A fatal error occurred during client reset: 'User-provided callback failed', inner error: 'RealmException: No such table exists. Error code: 3020.'
iOS: ClientResetError message: A fatal error occurred during client reset: 'User-provided callback failed', inner error: 'RealmException: Error getting property count. No such table exists. Error code: 3020.'
Application hangs with 'gray-screen' and no information is displayed to the user, but after restart it starts without any issues.
Repro steps
I'm still unable to reproduce this issue.
It never occurred during development, only on pre-production devices in internal testing & test flight.
Version
3.1.0
What Atlas Services are you using?
Atlas Device Sync
What type of application is this?
Flutter Application
Client OS and version
Android 14, iOS 17.5.1
Code snippets
No response
Stacktrace of the exception/crash you're getting
Relevant log output
No response
The text was updated successfully, but these errors were encountered: