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

Possible crash in notification streams #1492

Closed
nielsenko opened this issue Jan 25, 2024 · 1 comment · Fixed by #1491
Closed

Possible crash in notification streams #1492

nielsenko opened this issue Jan 25, 2024 · 1 comment · Fixed by #1491
Assignees

Comments

@nielsenko
Copy link
Contributor

nielsenko commented Jan 25, 2024

Running the following loop long enough, will either hang the notifications, or in rare cases crash the app. At least on macOS 14.3 Sonoma, using realm 1.7, and dart 3.2.5.

import 'dart:isolate';

import 'package:realm_dart/realm.dart';

part 'stream_101.g.dart';

@RealmModel()
class _Stuff {
  late int value;
}

final realm = Realm(Configuration.local([Stuff.schema]));

Future<void> main(List<String> arguments) async {
  Isolate.run(() async {
    int i = 0;
    while (true) {
      realm.write(() {
        realm.add(Stuff(i++));
      });
      await Future.delayed(const Duration(milliseconds: 200));
    }
  });

  final results = realm.all<Stuff>();
  await for (final stuff in results.changes) {
    print(stuff.results.length);
  }
}
@nielsenko
Copy link
Contributor Author

This was discovered while looking into the latest comments on #1451

@nielsenko nielsenko self-assigned this Jan 25, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant