-
Notifications
You must be signed in to change notification settings - Fork 85
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
SIGSEGV: null pointer dereference from 1.7.0 up #1532
Comments
➤ PM Bot commented: Jira ticket: RDART-955 |
This is a bit difficult for us to work with. Our tests runs fine with v1.9.0 on Android 14, and we obviously do test log out. We will need a minimal reproduction to proceed with this. I have created a minimal app, that you can iterate on, if you prefer. Can you make it crash? import 'package:flutter/material.dart';
import 'package:realm/realm.dart';
part 'main.g.dart';
@RealmModel()
class _Stuff {
@MapTo('_id')
@PrimaryKey()
late ObjectId id;
}
const appId = String.fromEnvironment('REALM_APP_ID');
const email = String.fromEnvironment('REALM_USER_EMAIL');
const password = String.fromEnvironment('REALM_USER_PASSWORD');
final credentials = Credentials.emailPassword(email, password);
final app = App(AppConfiguration(appId));
final _initRealm = () async {
final user = await app.logIn(credentials);
return Realm(Configuration.flexibleSync(user, [Stuff.schema]));
}();
late final Realm realm;
void main() async {
Realm.logger.level = RealmLogLevel.all;
realm = await _initRealm;
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: StreamBuilder(
stream: realm.syncSession.connectionStateChanges,
builder: (context, snapshot) {
final state = snapshot.data?.current ?? realm.syncSession.connectionState;
return Text(state.name);
},
),
),
floatingActionButton: StreamBuilder(
stream: realm.syncSession.user.changes,
builder: (context, snapshot) {
final userState = (snapshot.data?.user ?? app.currentUser!).state;
return FloatingActionButton(
child: Icon(switch (userState) {
UserState.loggedIn => Icons.logout,
UserState.loggedOut => Icons.login,
_ => Icons.error,
}),
onPressed: () async {
switch (userState) {
case UserState.loggedIn:
await app.currentUser?.logOut();
break;
case UserState.loggedOut:
await app.logIn(credentials);
break;
default:
break;
}
},
);
},
),
),
);
}
} |
It's a pretty big project that we see issues with, but I'll try to diagnose it further and prepare some PoC.... |
@SPodjasek You can also open a support ticket on your MongoDB Cloud account, then (depending on your plan) a TSE should get back to you. |
@nielsenko This is true heisenbug, the more I try to diagnose it, the less probable it will occur. Maybe it will ring some bells. If not I'll close this issue as by current state - it is some edge case that I'm unable to reproduce. First case
Second case
|
Here is an Android arm64 debug build of version 1.9.0. Could you try re-creating with this binary? |
@nielsenko Are you sure that the binary above is the right one? I mean the size differs from the one that pub package downloads, but it shows that library is stripped and looking at startup logs they look the same. I've checked the apk ( This is the startup log from exception I've caught today: Startup logs
Exception
I still haven't found the path that triggers this exception. |
@SPodjasek Sorry - I must have slept at the helm. Here is an updated lib ❯ file librealm_dart.so
librealm_dart.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5a7de66ca03e73645d14fdb4515e7c35395b137d, with de
bug_info, not stripped |
I've caught an exception today ;) Logs
As for now my best guess is that this exception requires active updates on cloud side to occur. I've small loop in |
Seems like you get a callback from the scheduler after the Realm has been closed and the transaction has been deleted. We should probably be a bit more robust in this situation. I have created a realm-core issue to handle this. |
This is now tracked by realm/realm-core#7434, so I'll close the dart issue. |
What happened?
Starting from version 1.7.0 up (bug was detected after upgrade to 1.9.0 from 1.6.1) we see application crashes probably caused by user logging out from AppServices and realm closing database.
After downgrading to 1.6.1 everything works as expected.
Repro steps
Version
Dart 3.3.0; Flutter 3.19.1
What Atlas Services are you using?
Both Atlas Device Sync and Atlas App Services
What type of application is this?
Flutter Application
Client OS and version
Android 14
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: