Skip to content
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

Closed
SPodjasek opened this issue Feb 29, 2024 · 11 comments
Closed

SIGSEGV: null pointer dereference from 1.7.0 up #1532

SPodjasek opened this issue Feb 29, 2024 · 11 comments
Assignees

Comments

@SPodjasek
Copy link

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

  1. Login to Atlas App Services with idToken
  2. Open synced realm with flexible sync
  3. Logout from App Services
  4. Realm is closing
  5. Crash

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

Build fingerprint: 'google/panther/panther:14/UQ1A.240205.002/11224170:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
Timestamp: 2024-02-29 16:15:22.471350839+0100
Process uptime: 22s
Cmdline: ********
pid: 25226, tid: 25378, name: 1.ui  >>> ***** <<<
uid: 10287
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x000000000000029c
Cause: null pointer dereference
    x0  000000000000029c  x1  0000006d174fbc81  x2  0000006ecc4482b4  x3  0000006d18204549
    x4  b400007056cf8970  x5  0000000000000000  x6  0000006d0caa5eb1  x7  000000000000001f
    x8  c4279bbc2a99832d  x9  0000000000000001  x10 0000000000000002  x11 0000000000000000
    x12 0000000000000000  x13 ffffff92e7dfbabf  x14 0000000000000000  x15 0000006f80204e40
    x16 0000006ecc9cb9a8  x17 00000072b6ef6e50  x18 0000006eeb7cc000  x19 0000006f80204d88
    x20 0000000000000000  x21 0000006f80206000  x22 0000006d00008081  x23 0000006eeef459e8
    x24 0000006d00008081  x25 0000006f8012b000  x26 b40000712769bb80  x27 0000006d0ab6dd40
    x28 000000080000006d  x29 0000006f80204ce0
    lr  0000006ecc8c5540  sp  0000006f80204ce0  pc  00000072b6ef6e58  pst 0000000080001000
8 total frames
backtrace:
      #00 pc 00000000000cae58  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+8) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
      #01 pc 00000000008c253c  /data/app/~~Y7c-PDewOcM6dlh6kJMNOQ==/******-u2ggXUYnnHPnaR7yYX5oxQ==/lib/arm64/librealm_dart.so (std::__ndk1::mutex::lock()+12) (BuildId: 69308beb1f46a85c209ff2f51c8a4c01fa69d6b8)
      #02 pc 000000000048ef40  /data/app/~~Y7c-PDewOcM6dlh6kJMNOQ==/******-u2ggXUYnnHPnaR7yYX5oxQ==/lib/arm64/librealm_dart.so (BuildId: 69308beb1f46a85c209ff2f51c8a4c01fa69d6b8)
      #03 pc 000000000048d540  /data/app/~~Y7c-PDewOcM6dlh6kJMNOQ==/******-u2ggXUYnnHPnaR7yYX5oxQ==/lib/arm64/librealm_dart.so (BuildId: 69308beb1f46a85c209ff2f51c8a4c01fa69d6b8)
      #04 pc 000000000048efa4  /data/app/~~Y7c-PDewOcM6dlh6kJMNOQ==/******-u2ggXUYnnHPnaR7yYX5oxQ==/lib/arm64/librealm_dart.so (BuildId: 69308beb1f46a85c209ff2f51c8a4c01fa69d6b8)
      #05 pc 00000000004938a4  /data/app/~~Y7c-PDewOcM6dlh6kJMNOQ==/******-u2ggXUYnnHPnaR7yYX5oxQ==/lib/arm64/librealm_dart.so (BuildId: 69308beb1f46a85c209ff2f51c8a4c01fa69d6b8)
      #06 pc 00000000004c2444  /data/app/~~Y7c-PDewOcM6dlh6kJMNOQ==/******-u2ggXUYnnHPnaR7yYX5oxQ==/lib/arm64/librealm_dart.so (BuildId: 69308beb1f46a85c209ff2f51c8a4c01fa69d6b8)
      #07 pc 0000000000007bc4  [anon:dart-code]
Lost connection to device.
the Dart compiler exited unexpectedly.

Relevant log output

No response

Copy link

sync-by-unito bot commented Feb 29, 2024

➤ PM Bot commented:

Jira ticket: RDART-955

@SPodjasek SPodjasek changed the title SIGSEGV: null pointer dereference from 1.7.0 SIGSEGV: null pointer dereference from 1.7.0 up Feb 29, 2024
@nielsenko nielsenko self-assigned this Mar 1, 2024
@nielsenko
Copy link
Contributor

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;
                }
              },
            );
          },
        ),
      ),
    );
  }
}

@nielsenko nielsenko added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Mar 1, 2024
@SPodjasek
Copy link
Author

It's a pretty big project that we see issues with, but I'll try to diagnose it further and prepare some PoC....

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Mar 1, 2024
@nielsenko
Copy link
Contributor

@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.

@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels Mar 4, 2024
@SPodjasek
Copy link
Author

@nielsenko This is true heisenbug, the more I try to diagnose it, the less probable it will occur.
I wasn't able to reproduce this bug in any predictable manner. After changing log level to 'all' (Realm.logger.level = RealmLogLevel.all) it started work properly. I was only able to trigger two failures in many, many tries - still without much clue what triggered it.

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

/flutter ( 2821): 2024-03-02T20:26:54.593701: [TRACE] Realm: DB: 9411 Thread 476597378224: Start read 24633: 138 ref 3928
I/flutter ( 2821): 2024-03-02T20:26:54.593772: [TRACE] Realm: DB: 9411 Thread 476597378224: End transaction 24633
I/flutter ( 2821): 2024-03-02T20:26:54.593843: [TRACE] Realm: DB: 9411 Thread 476597378224: Start read 16333: 138 ref 3928
I/flutter ( 2821): 2024-03-02T20:26:54.593910: [TRACE] Realm: DB: 9411 Thread 476597378224: End transaction 16333
I/flutter ( 2821): 2024-03-02T20:26:54.593976: [DETAIL] Realm: DB: 9411 Thread 476597378224: DB closed
I/flutter ( 2821): 2024-03-02T20:26:54.594090: [TRACE] Realm: DB: 21668 Thread 476597378224: Tr 39883: Already on version: 227
I/flutter ( 2821): 2024-03-02T20:26:54.594179: [TRACE] Realm: DB: 21668 Thread 476597378224: Tr 39883: Promote to write: 227 -> 227
I/flutter ( 2821): 2024-03-02T20:26:54.594253: [DEBUG] Realm: DB: 21668 Thread 476597378224: Query count: 'fcmToken == "....."', limit = -1
I/flutter ( 2821): 2024-03-02T20:26:54.594331: [DEBUG] Realm: DB: 21668 Thread 476597378224: Query matches: 1, Duration: 10 us
I/flutter ( 2821): 2024-03-02T20:26:54.594435: [DEBUG] Realm: DB: 21668 Thread 476597378224: Query count: 'fcmToken == "....."', limit = -1
I/flutter ( 2821): 2024-03-02T20:26:54.594510: [DEBUG] Realm: DB: 21668 Thread 476597378224: Query matches: 1, Duration: 2 us
I/flutter ( 2821): 2024-03-02T20:26:54.594580: [DEBUG] Realm: DB: 21668 Thread 476597378224: Query find all: 'fcmToken == "....."', limit = -1
I/flutter ( 2821): 2024-03-02T20:26:54.594720: [DEBUG] Realm: DB: 21668 Thread 476597378224: Query found: 1, Duration: 3 us
I/flutter ( 2821): 2024-03-02T20:26:54.594799: [DEBUG] Realm: DB: 21668 Thread 476597378224: Initiate commit version: 228
I/flutter ( 2821): 2024-03-02T20:26:54.594871: [DEBUG] Realm: DB: 21668 Thread 476597378224: Commit of size 2480 done in 2324 us (no commit to disk)
I/flutter ( 2821): 2024-03-02T20:26:54.594940: [TRACE] Realm: DB: 21668 Thread 476597378224: Start read 783: 228 ref 82360
I/flutter ( 2821): 2024-03-02T20:26:54.595016: [TRACE] Realm: DB: 21668 Thread 481256049840: Tr 39883: Committing ref 82360 to disk
I/flutter ( 2821): 2024-03-02T20:26:54.595086: [TRACE] Realm: DB: 21668 Thread 475496168624: Start read 12233: 228 ref 82360
F/libc    ( 2821): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x29c in tid 2967 (1.ui), pid 2821 (......)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/panther/panther:14/UQ1A.240205.002/11224170:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
Timestamp: 2024-03-02 20:26:54.926756092+0100
Process uptime: 646s
Cmdline: ......
pid: 2821, tid: 2967, name: 1.ui  >>> ...... <<<
uid: 10287
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x000000000000029c
Cause: null pointer dereference
    x0  000000000000029c  x1  0000006d0a1d9451  x2  0000006ecf44dad4  x3  0000006d17c9bb19
    x4  b400007056cf86b0  x5  0000000000000000  x6  0000006d0c067b51  x7  00000000000001c9
    x8  5483282492654334  x9  0000000000000001  x10 0000000000000002  x11 0000000000000000
    x12 0000000000000000  x13 ffffff92e83644ef  x14 0000000000000000  x15 0000006ef76ace50
    x16 0000006ecf9d2c30  x17 00000072b6ef6e50  x18 0000006ef6abc000  x19 0000006ef76acd98
    x20 0000000000000000  x21 0000006ef76ae000  x22 0000006d00008081  x23 0000006ef0d139e8
    x24 0000006d00008081  x25 0000006ef75d3000  x26 b40000712769fbc0  x27 0000006d0a189d50
    x28 000000080000006d  x29 0000006ef76accf0
    lr  0000006ecf8cc3bc  sp  0000006ef76accf0  pc  00000072b6ef6e58  pst 0000000080001000
8 total frames
backtrace:
      #00 pc 00000000000cae58  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+8) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
      #01 pc 00000000008c53b8  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/......-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (std::__ndk1::mutex::lock()+12) (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #02 pc 0000000000491438  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/......-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #03 pc 000000000048fa38  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/......-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #04 pc 000000000049149c  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/......-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #05 pc 0000000000495d9c  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/......-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #06 pc 00000000004c493c  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/......-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #07 pc 0000000000007bc4  [anon:dart-code]

Second case

I/flutter ( 5767): 2024-03-02T20:34:57.854229: [TRACE] Realm: DB: 58673 Thread 476609289392: End transaction 29583
I/flutter ( 5767): 2024-03-02T20:34:57.854301: [DETAIL] Realm: DB: 58673 Thread 476609289392: DB closed
I/flutter ( 5767): 2024-03-02T20:34:57.854458: [TRACE] Realm: DB: 60733 Thread 476609289392: Tr 22133: Already on version: 270
I/flutter ( 5767): 2024-03-02T20:34:57.854541: [TRACE] Realm: DB: 60733 Thread 476609289392: Tr 22133: Promote to write: 270 -> 270
I/flutter ( 5767): 2024-03-02T20:34:57.854611: [DEBUG] Realm: DB: 60733 Thread 476609289392: Query count: 'fcmToken == "....."', limit = -1
I/flutter ( 5767): 2024-03-02T20:34:57.854698: [DEBUG] Realm: DB: 60733 Thread 476609289392: Query matches: 1, Duration: 11 us
I/flutter ( 5767): 2024-03-02T20:34:57.854774: [DEBUG] Realm: DB: 60733 Thread 476609289392: Query count: 'fcmToken == "....."', limit = -1
I/flutter ( 5767): 2024-03-02T20:34:57.854998: [DEBUG] Realm: DB: 60733 Thread 476609289392: Query matches: 1, Duration: 2 us
I/flutter ( 5767): 2024-03-02T20:34:57.855107: [DEBUG] Realm: DB: 60733 Thread 476609289392: Query find all: 'fcmToken == "....."', limit = -1
I/flutter ( 5767): 2024-03-02T20:34:57.855263: [DEBUG] Realm: DB: 60733 Thread 476609289392: Query found: 1, Duration: 3 us
I/flutter ( 5767): 2024-03-02T20:34:57.855494: [DEBUG] Realm: DB: 60733 Thread 476609289392: Initiate commit version: 271
I/flutter ( 5767): 2024-03-02T20:34:57.855581: [DEBUG] Realm: DB: 60733 Thread 476609289392: Commit of size 2480 done in 2631 us (no commit to disk)
I/flutter ( 5767): 2024-03-02T20:34:57.855658: [TRACE] Realm: DB: 60733 Thread 476609289392: Start read 17633: 271 ref 93648
I/flutter ( 5767): 2024-03-02T20:34:57.855732: [TRACE] Realm: DB: 60733 Thread 475455798448: Start read 28783: 271 ref 93648
I/flutter ( 5767): 2024-03-02T20:34:57.855810: [TRACE] Realm: DB: 60733 Thread 481446157488: Tr 22133: Committing ref 93648 to disk
I/flutter ( 5767): 2024-03-02T20:34:57.855899: [TRACE] Realm: DB: 60733 Thread 475455798448: Tr 19683: Advance read: 270 -> 271 ref 93648
I/flutter ( 5767): 2024-03-02T20:34:57.855977: [TRACE] Realm: DB: 60733 Thread 475455798448: Tr 21733: Advance read: 270 -> 271 ref 93648
I/flutter ( 5767): 2024-03-02T20:34:57.856061: [TRACE] Realm: DB: 60733 Thread 475455798448: Tr 12733: Advance read: 270 -> 271 ref 93648
I/flutter ( 5767): 2024-03-02T20:34:57.856141: [TRACE] Realm: DB: 60733 Thread 475455798448: Tr 13883: Advance read: 270 -> 271 ref 93648
F/libc    ( 5767): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x29c in tid 5858 (1.ui), pid 5767 (.....)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/panther/panther:14/UQ1A.240205.002/11224170:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
Timestamp: 2024-03-02 20:34:58.179059917+0100
Process uptime: 64s
Cmdline: .....
pid: 5767, tid: 5858, name: 1.ui  >>> ..... <<<
uid: 10287
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x000000000000029c
Cause: null pointer dereference
    x0  000000000000029c  x1  0000006d180bf431  x2  0000006ecde50ad4  x3  0000006d17e15b99
    x4  b400007056cf7630  x5  0000000000000000  x6  0000006d0b645a11  x7  000000000000008b
    x8  e7e693f897588dce  x9  0000000000000001  x10 0000000000000002  x11 0000000000000000
    x12 0000000000000000  x13 ffffff92e81ea46f  x14 0000000000000000  x15 0000006ef8208e40
    x16 0000006ece3d5c30  x17 00000072b6ef6e50  x18 0000006eed89e000  x19 0000006ef8208d88
    x20 0000000000000000  x21 0000006ef820a000  x22 0000006d00008081  x23 0000006ef59599e8
    x24 0000006d00008081  x25 0000006ef812f000  x26 b4000071276a0bd0  x27 0000006d166ee4a0
    x28 000000080000006d  x29 0000006ef8208ce0
    lr  0000006ece2cf3bc  sp  0000006ef8208ce0  pc  00000072b6ef6e58  pst 0000000080001000
8 total frames
backtrace:
      #00 pc 00000000000cae58  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+8) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
      #01 pc 00000000008c53b8  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/.....-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (std::__ndk1::mutex::lock()+12) (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #02 pc 0000000000491438  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/.....-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #03 pc 000000000048fa38  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/.....-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #04 pc 000000000049149c  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/.....-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #05 pc 0000000000495d9c  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/.....-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #06 pc 00000000004c493c  /data/app/~~9I9-A1d2IbnJ9OA1GsHKug==/.....-aXoREJjZJa0IEmwSNl-sVw==/lib/arm64/librealm_dart.so (BuildId: aeeb32a93d9ebce62aeb00ebf629eac15a25da4f)
      #07 pc 0000000000007bc4  [anon:dart-code]

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Mar 4, 2024
@nielsenko
Copy link
Contributor

nielsenko commented Mar 4, 2024

Here is an Android arm64 debug build of version 1.9.0. Could you try re-creating with this binary?
librealm_dart.so.zip EDIT: Updated

@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels Mar 6, 2024
@SPodjasek
Copy link
Author

SPodjasek commented Mar 7, 2024

@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 (./build/app/outputs/apk/debug/app-debug.apk) and it included proper file, also the BuildId in exception matches that from in your debug build.

This is the startup log from exception I've caught today:

Startup logs

I/flutter (18996): 2024-03-07T10:53:21.363952: [TRACE] Realm: Default event loop: start()
I/flutter (18996): 2024-03-07T10:53:21.364046: [TRACE] Realm: Default event loop: thread running
I/flutter (18996): 2024-03-07T10:53:21.364119: [TRACE] Realm: Default event loop: service run
I/flutter (18996): 2024-03-07T10:53:21.364190: [INFO] Realm: Realm sync client ([realm-core-13.26.0])
I/flutter (18996): 2024-03-07T10:53:21.364262: [DEBUG] Realm: Supported protocol versions: 2-11
I/flutter (18996): 2024-03-07T10:53:21.364331: [INFO] Realm: Platform: Android Linux 5.10.177-android13-4-00003-ga7208022a7ea-ab10815828 #1 SMP PREEMPT Fri Sep 15 16:40:54 UTC 2023 aarch64
I/flutter (18996): 2024-03-07T10:53:21.364427: [DEBUG] Realm: Build mode: Release
I/flutter (18996): 2024-03-07T10:53:21.364496: [DEBUG] Realm: Config param: one_connection_per_session = false
I/flutter (18996): 2024-03-07T10:53:21.364579: [DEBUG] Realm: Config param: connect_timeout = 120000 ms
I/flutter (18996): 2024-03-07T10:53:21.364651: [DEBUG] Realm: Config param: connection_linger_time = 30000 ms
I/flutter (18996): 2024-03-07T10:53:21.364718: [DEBUG] Realm: Config param: ping_keepalive_period = 60000 ms
I/flutter (18996): 2024-03-07T10:53:21.364791: [DEBUG] Realm: Config param: pong_keepalive_timeout = 120000 ms
I/flutter (18996): 2024-03-07T10:53:21.364855: [DEBUG] Realm: Config param: fast_reconnect_limit = 60000 ms
I/flutter (18996): 2024-03-07T10:53:21.364923: [DEBUG] Realm: Config param: disable_upload_compaction = false
I/flutter (18996): 2024-03-07T10:53:21.365008: [DEBUG] Realm: Config param: disable_sync_to_disk = false
I/flutter (18996): 2024-03-07T10:53:21.365077: [DEBUG] Realm: Config param: reconnect backoff info: max_delay: 300000 ms, initial_delay: 1000 ms, multiplier: 2

Exception

I/flutter (18996): 2024-03-07T10:53:29.910195: [TRACE] Realm: DB: 32923 Thread 478890974384: Tr 20633: Already on version: 112
I/flutter (18996): 2024-03-07T10:53:29.910430: [TRACE] Realm: DB: 32923 Thread 478890974384: Tr 20633: Promote to write: 112 -> 112
I/flutter (18996): 2024-03-07T10:53:29.910541: [DEBUG] Realm: DB: 32923 Thread 478890974384: Query count: 'fcmToken == "....."', limit = -1
I/flutter (18996): 2024-03-07T10:53:29.910638: [DEBUG] Realm: DB: 32923 Thread 478890974384: Query matches: 1, Duration: 7 us
I/flutter (18996): 2024-03-07T10:53:29.910721: [DEBUG] Realm: DB: 32923 Thread 478890974384: Query count: 'fcmToken == "....."', limit = -1
I/flutter (18996): 2024-03-07T10:53:29.910831: [DEBUG] Realm: DB: 32923 Thread 478890974384: Query matches: 1, Duration: 1 us
I/flutter (18996): 2024-03-07T10:53:29.910922: [DEBUG] Realm: DB: 32923 Thread 478890974384: Query find all: 'fcmToken == "....."', limit = -1
I/flutter (18996): 2024-03-07T10:53:29.911012: [DEBUG] Realm: DB: 32923 Thread 478890974384: Query found: 1, Duration: 2 us
I/flutter (18996): 2024-03-07T10:53:29.911092: [DEBUG] Realm: DB: 32923 Thread 478890974384: Initiate commit version: 113
I/flutter (18996): 2024-03-07T10:53:29.911181: [DEBUG] Realm: DB: 32923 Thread 478890974384: Commit of size 2712 done in 2031 us (no commit to disk)
I/flutter (18996): 2024-03-07T10:53:29.911261: [TRACE] Realm: DB: 32923 Thread 478890974384: Start read 27833: 113 ref 85560
I/flutter (18996): 2024-03-07T10:53:29.911344: [TRACE] Realm: DB: 32923 Thread 475456847024: Start read 27983: 113 ref 85560
I/flutter (18996): 2024-03-07T10:53:29.911434: [TRACE] Realm: DB: 32923 Thread 475456847024: Tr 63719: Advance read: 112 -> 113 ref 85560
I/flutter (18996): 2024-03-07T10:53:29.911503: [TRACE] Realm: DB: 32923 Thread 475456847024: Tr 13983: Advance read: 112 -> 113 ref 85560
I/flutter (18996): 2024-03-07T10:53:29.911570: [TRACE] Realm: DB: 32923 Thread 475456847024: Tr 18883: Advance read: 112 -> 113 ref 85560
I/flutter (18996): 2024-03-07T10:53:29.911645: [TRACE] Realm: DB: 32923 Thread 475456847024: Tr 12383: Advance read: 112 -> 113 ref 85560
I/flutter (18996): 2024-03-07T10:53:29.911720: [TRACE] Realm: DB: 32923 Thread 475456847024: Tr 19133: Advance read: 112 -> 113 ref 85560
I/flutter (18996): 2024-03-07T10:53:29.911918: [TRACE] Realm: DB: 32923 Thread 475456847024: Start read 30883: 113 ref 85560
I/flutter (18996): 2024-03-07T10:53:29.912057: [TRACE] Realm: DB: 32923 Thread 475456847024: End transaction 10533
I/flutter (18996): 2024-03-07T10:53:29.912150: [TRACE] Realm: DB: 32923 Thread 475456847024: End transaction 27833
I/flutter (18996): 2024-03-07T10:53:29.912357: [TRACE] Realm: DB: 32923 Thread 475456847024: End transaction 27983
F/libc    (18996): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x29c in tid 19132 (1.ui), pid 18996 (....)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/panther/panther:14/UQ1A.240205.002/11224170:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
Timestamp: 2024-03-07 10:53:30.052502935+0100
Process uptime: 30s
Cmdline: .....
pid: 18996, tid: 19132, name: 1.ui  >>> ..... <<<
uid: 10287
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x000000000000029c
Cause: null pointer dereference
    x0  000000000000029c  x1  b400007166d1c738  x2  b400007166d1c738  x3  0000006d18187ed9
    x4  b400007056cfca10  x5  0000000000000000  x6  0000006d0b89ba01  x7  0000000000000043
    x8  4175515fcf393ad7  x9  4175515fcf393ad7  x10 0000000000000002  x11 0000000000000000
    x12 0000000000000000  x13 ffffff92e7e7812f  x14 0000000000000000  x15 0000006f80204e40
    x16 0000006ece522bf0  x17 00000072b6ef6e50  x18 0000006eeef24000  x19 000000000000029c
    x20 0000006f80204d88  x21 0000000000000000  x22 0000006f80206000  x23 0000006ef45369e8
    x24 0000006d00008081  x25 0000006f8012b000  x26 b4000071276a0bd0  x27 0000006d0c47c9a0
    x28 000000080000006d  x29 0000006f80204cf0
    lr  0000006ece41cb74  sp  0000006f80204cf0  pc  00000072b6ef6e58  pst 0000000080001000
7 total frames
backtrace:
      #00 pc 00000000000cae58  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+8) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
      #01 pc 00000000008f0b70  /data/app/~~6QJR_TCX_pix-wPhizjFdw==/.....-RnWqGR52W3WUXUpQs1vlLg==/lib/arm64/librealm_dart.so (std::__ndk1::mutex::lock()+12) (BuildId: aee580352180e9a97f23ed81eea59cf46042f46a)
      #02 pc 00000000004533ec  /data/app/~~6QJR_TCX_pix-wPhizjFdw==/.....-RnWqGR52W3WUXUpQs1vlLg==/lib/arm64/librealm_dart.so (BuildId: aee580352180e9a97f23ed81eea59cf46042f46a)
      #03 pc 000000000045111c  /data/app/~~6QJR_TCX_pix-wPhizjFdw==/.....-RnWqGR52W3WUXUpQs1vlLg==/lib/arm64/librealm_dart.so (BuildId: aee580352180e9a97f23ed81eea59cf46042f46a)
      #04 pc 00000000004581f8  /data/app/~~6QJR_TCX_pix-wPhizjFdw==/.....-RnWqGR52W3WUXUpQs1vlLg==/lib/arm64/librealm_dart.so (BuildId: aee580352180e9a97f23ed81eea59cf46042f46a)
      #05 pc 000000000048a088  /data/app/~~6QJR_TCX_pix-wPhizjFdw==/.....-RnWqGR52W3WUXUpQs1vlLg==/lib/arm64/librealm_dart.so (BuildId: aee580352180e9a97f23ed81eea59cf46042f46a)
      #06 pc 0000000000007bc4  [anon:dart-code]

I still haven't found the path that triggers this exception.

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Mar 7, 2024
@nielsenko
Copy link
Contributor

nielsenko commented Mar 7, 2024

@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

@SPodjasek
Copy link
Author

I've caught an exception today ;)

Logs

I/flutter (32080): 2024-03-08T10:56:43.151230: [TRACE] Realm: DB: 2201 Thread 476468657328: Tr 32783: Already on version: 72
I/flutter (32080): 2024-03-08T10:56:43.151288: [TRACE] Realm: DB: 2201 Thread 476468657328: Tr 32783: Promote to write: 72 -> 72
I/flutter (32080): 2024-03-08T10:56:43.151342: [DEBUG] Realm: DB: 2201 Thread 476468657328: Query count: 'fcmToken == "....."', limit = -1
I/flutter (32080): 2024-03-08T10:56:43.151395: [DEBUG] Realm: DB: 2201 Thread 476468657328: Query matches: 1, Duration: 39 us
I/flutter (32080): 2024-03-08T10:56:43.151453: [DEBUG] Realm: DB: 2201 Thread 476468657328: Query count: 'fcmToken == "....."', limit = -1
I/flutter (32080): 2024-03-08T10:56:43.151511: [DEBUG] Realm: DB: 2201 Thread 476468657328: Query matches: 1, Duration: 9 us
I/flutter (32080): 2024-03-08T10:56:43.151593: [DEBUG] Realm: DB: 2201 Thread 476468657328: Query find all: 'fcmToken == "....."', limit = -1
I/flutter (32080): 2024-03-08T10:56:43.151653: [DEBUG] Realm: DB: 2201 Thread 476468657328: Query found: 1, Duration: 17 us
I/flutter (32080): 2024-03-08T10:56:43.151706: [DEBUG] Realm: DB: 2201 Thread 476468657328: Initiate commit version: 73
I/flutter (32080): 2024-03-08T10:56:43.151763: [DEBUG] Realm: DB: 2201 Thread 476468657328: Commit of size 2632 done in 10083 us (no commit to disk)
I/flutter (32080): 2024-03-08T10:56:43.151826: [TRACE] Realm: DB: 2201 Thread 476468657328: Start read 33833: 73 ref 148128
I/flutter (32080): 2024-03-08T10:56:43.151878: [TRACE] Realm: DB: 2201 Thread 481357143216: Tr 32783: Committing ref 148128 to disk
I/flutter (32080): 2024-03-08T10:56:43.151934: [TRACE] Realm: DB: 2201 Thread 475277540528: Start read 37383: 73 ref 148128
F/libc    (32080): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x29c in tid 32199 (1.ui), pid 32080 (...)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/panther/panther:14/UQ1A.240205.002/11224170:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
Timestamp: 2024-03-08 10:56:43.487035679+0100
Process uptime: 246s
Cmdline: ......
pid: 32080, tid: 32199, name: 1.ui  >>> ...... <<<
uid: 10293
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x000000000000029c
Cause: null pointer dereference
    x0  000000000000029c  x1  000000000000029c  x2  b400007046df9958  x3  0000006d181ff499
    x4  b400007056cf70b0  x5  0000000000000000  x6  0000006d0bf2c5c1  x7  00000000000000d1
    x8  0000006eefbeabd8  x9  0000000000000001  x10 0000000000000002  x11 0000000000000000
    x12 0000000000000000  x13 ffffff92e7e00b6f  x14 0000000000000000  x15 0000006eefbeae40
    x16 0000006ec71c30f8  x17 00000072b6ef6e50  x18 0000006eeb9ca000  x19 0000006fec8a03e0
    x20 0000006eefbeb338  x21 b4000071276a4c10  x22 0000006d00008081  x23 0000006ee71209e8
    x24 0000006d00008081  x25 0000006eefb11000  x26 b4000071276a4c10  x27 0000006d090b0c50
    x28 000000080000006d  x29 0000006eefbeab00
    lr  0000006ec70b9dec  sp  0000006eefbeab00  pc  00000072b6ef6e58  pst 00000000a0001000
14 total frames
backtrace:
      #00 pc 00000000000cae58  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+8) (BuildId: 19c32900d9d702c303d2b4164fbba76c)
      #01 pc 000000000118bde8  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (std::__ndk1::mutex::lock()+12) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #02 pc 00000000006ee600  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (std::__ndk1::unique_lock<std::__ndk1::mutex>::unique_lock[abi:v170000](std::__ndk1::mutex&)+40) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #03 pc 00000000006ee5c8  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm::util::CheckedMutex::lock() const+36) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #04 pc 00000000006ee514  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm::util::CheckedLockGuard::CheckedLockGuard<realm::util::CheckedMutex>(realm::util::CheckedMutex const&)+24) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #05 pc 00000000007da248  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm::Transaction::get_commit_exception()+52) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #06 pc 00000000007d62f4  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm::Realm::call_completion_callbacks()+84) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #07 pc 00000000007da6c4  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm::Realm::run_async_completions()+20) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #08 pc 00000000007edbb8  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm::Realm::end_current_write(bool)::$_0::operator()()::'lambda'()::operator()()+24) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #09 pc 00000000007edb90  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm::util::UniqueFunction<void ()>::SpecificImpl<realm::Realm::end_current_write(bool)::$_0::operator()()::'lambda'()>::call()+20) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #10 pc 00000000006d484c  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm::util::UniqueFunction<void ()>::operator()() const+112) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #11 pc 000000000089f8f4  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm::util::InvocationQueue::invoke_all()+160) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #12 pc 00000000006d5db8  /data/app/~~EQl30iPJs59oamCmxB41aw==/......-Nxby_7FHdk93UtHCuPyQlQ==/lib/arm64/librealm_dart.so (realm_scheduler_perform_work+16) (BuildId: 5a7de66ca03e73645d14fdb4515e7c35395b137d)
      #13 pc 0000000000007bc4  [anon:dart-code]

As for now my best guess is that this exception requires active updates on cloud side to occur.

I've small loop in mongosh running updates to single collection on Atlas every second and during test session today I've logged in and out 4 times. Exception occurred after last logout attempt. If you need, I have full session logs available, but I would prefer to share them privately as they may contain some non-public or sensitive data.

@jedelbo
Copy link

jedelbo commented Mar 8, 2024

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.

@nirinchev
Copy link
Member

This is now tracked by realm/realm-core#7434, so I'll close the dart issue.

@nirinchev nirinchev closed this as not planned Won't fix, can't repro, duplicate, stale Mar 10, 2024
@sync-by-unito sync-by-unito bot removed the Needs-Attention Reporter has responded. Review comment. label Mar 10, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants